I'm trying to combine two PDF pages into one PDF. I'm using the following code to do this:
Dim oMerge As New MergeDocument
Dim oDoc1 As New PdfDocument("c:\book1.pdf")
Dim iPage As New ImportedPage(oDoc1.Pages(1))
Dim oDoc2 As New PdfDocument("c:\book2.pdf")
Dim iPageData As New ImportedPageData(oDoc2.Pages(0))
iPage.Elements.Add(iPageData)
oMerge.Pages.Add(iPage)
oMerge.Draw("c:\output.pdf")
This creates an "object" representing the page from book2, rather than combining the two pages as one.
Is it possible to merge two imported pages? (i.e. flatten them?)
Flatten Imported Page Data
Re: Flatten Imported Page Data
Support · Sep 13, 2006Hello,
In order to merge or combine two separate PDF documents you can use the Append method of the MergeDocument object which will take the path of the PDF as string or PdfDocument object. ImportedPageData will get the data of a page which you can add to another page like adding a page element. The following sample code will help you to merge two PDF documents.
MergeDocument document = new MergeDocument();
document.Append("C:\temp\DocumentA.pdf");
document.Append("C:\temp\DocumentB.pdf");
document.DrawToWeb();
Do you want to place two separate PDF pages onto one single PDF page of the new document? If yes, please refer to the PlacePDFs example included with the product download.
Thanks,
ceTe Software Support Team
Re: Flatten Imported Page Data
Forum member · Sep 13, 2006The PlacePDFs example is very similar to mine except that it uses the ImportedPageArea object rather than the ImportedPageData, however, the results are the same.
When viewing the output pdf, the pages look as though they are one. But when you try to manipulate the overlayed page, with PitStop for example, the entire overlayed page is one object, rather than a collection of elements. (I'm probably using the wrong terms here, but either way I can't manipulate the text in the overlay)
If I distill the output PDF, all of the elements are combined into one page.
Without distilling it, how can I get the two pages combined without one being an object?
Re: Flatten Imported Page Data
Support · Sep 13, 2006Hello,
Can you please le us know what you mean by the distilling the output PDF? When you add two PDF pages to one PDF page using ImportedPageData, the elements from both pages will be combined and they will become part of the new PDF page. You cannot modify any existing contents on the two existing PDF pages. Our product will allow you to add new contents on the resultant PDF page after adding them using ImportedPageData.
Thanks,
ceTe Software Support Team