Product: 11.05
Product Version: pdftron
Please give a brief summary of your issue: I want to implement combine functionality using pdftron in c#.
(Think of this as an email subject)
I want to implement combine functionality using pdftron in c#. So I’m able to implement that functionality but the issue is I have to download the file first then pass the local path to PDFDoc. Is there any way I can overpass the download functionality and directly open the document through url.
I’m able to open the document through url in webviewer but in Apryse SDK.
Here is my code for the reference:
string file1Path = “doc1.pdf”;
string file2Path = “doc2.pdf”;
// Download the PDFs locally
using (WebClient client = new WebClient())
{
client.DownloadFile(“https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf”, file1Path);
client.DownloadFile(“https://www.orimi.com/pdf-test.pdf”, file2Path);
}
using (PDFDoc outputDoc = new PDFDoc())
{
// Load input PDF files
using (PDFDoc doc1 = new PDFDoc(file1Path))
using (PDFDoc doc2 = new PDFDoc(file2Path))
{
// Lock the document before editing
doc1.InitSecurityHandler();
doc2.InitSecurityHandler();
// Append pages from doc1
outputDoc.InsertPages(0, doc1, 1, doc1.GetPageCount(), PDFDoc.InsertFlag.e_none);
// Append pages from doc2
outputDoc.InsertPages(outputDoc.GetPageCount() + 1, doc2, 1, doc2.GetPageCount(), PDFDoc.InsertFlag.e_none);
// Save the output
outputDoc.Save("CombinedOutput.pdf", SDFDoc.SaveOptions.e_linearized);
Console.WriteLine("PDFs combined successfully to 'CombinedOutput.pdf'");
}
}