Posted by a ceTe Software moderator
Hello,
Yes, it is possible to import and merge pages from an external PDF into a new PDF that is being built. You can do this in a couple of different ways:
1. Import a page from an existing PDF and add it as separate page at the end of the new PDF. For additional samples please refer to the following documentation
link.
//Create a new document object.
Document document = new Document();
//add new pages.
document.Pages.Add(new Page());
document.Pages.Add(new Page());
document.Pages.Add(new Page());
//get second page from an existing PDF.
ImportedPage existingPDFPage = new ImportedPage(@"f:/ExistingDoc.pdf", 2);
//add the page at the end of the new PDF.
document.Pages.Add(existingPDFPage);
//save the new document.
document.Draw("final.pdf");
2. Import pages from an existing PDF and add them on a single page on the new PDF. Here you have the option to scale the imported pages if needed. For additional samples please refer to the following documentation
link.
//Create a new document object.
Document document = new Document();
//add new pages.
document.Pages.Add(new Page());
document.Pages.Add(new Page());
document.Pages.Add(new Page());
Page pageWithExistingPDFContent = new Page();
// Create ImportedPageArea objects and add it to the new page
ImportedPageArea existingPageContent1 = new ImportedPageArea(@"f:\DocumentD.pdf", 2, 0, 0, 0.5f);
pageWithExistingPDFContent.Elements.Add(existingPageContent1);
ImportedPageArea existingPageContent2 = new ImportedPageArea(@"f:\DocumentD.pdf", 3, 0, 300, 0.5f);
pageWithExistingPDFContent.Elements.Add(existingPageContent2);
document.Pages.Add(pageWithExistingPDFContent);
//save the new document.
document.Draw("final.pdf");
Thanks,
ceTe Software Support Team.