How can I combine two PDFs? I want to combine a background PDF ("stationery") with another PDF ("the letter"). Both PDFs already exist, so neither is something I want to generate.
Some other forum postings have suggested using the template functions. The syntax for using an existing PDF as a template is not clear to me from the documentation or examples.
Thanks
PDF as background for another PDF
Re: PDF as background for another PDF
Forum member · Sep 20, 2008I figured it out using ImportedPageData.
' Create a PDF Document
Dim MyDocument As Document = New Document
' Create a Page and add it to the document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
' Create an ImportedPageContents object
Dim MyContents As ImportedPageContents = _
New ImportedPageContents("C:\background.pdf", 1)
' Create an ImportedPage and add it to the document
Dim MyBackground As ImportedPageData = _
New ImportedPageData(MyContents)
MyPage.Elements.Add(MyBackground)
Dim MyVariableData As ImportedPageData = _
New ImportedPageData("C:\variabledata.pdf", 1)
MyPage.Elements.Add(MyVariableData)
' Save the PDF
MyDocument.Draw("C:\MyDocument.pdf")
Thanks.
Re: PDF as background for another PDF
Forum member · Apr 23, 2009Thanks for that lead. I didn't notice if you got a reply indicating that was the proper way to do it, but this is my program (inspired by yours) in Iron Python.
import clr
import sys
import System
sys.path.append('c:\\program files\\ceTe Software\\DynamicPDF v5.0.2 for .NET\\bin\\')
clr.AddReference('ceTe.DynamicPDF.35')
from ceTe.DynamicPDF import *
from ceTe.DynamicPDF.PageElements import *
from ceTe.DynamicPDF.Merger import *
document = Document();
page = Page();
document.Pages.Add(page);
pageOne = ImportedPageData("blueBox.pdf", 1);
pageTwo = ImportedPageData("redBox.pdf", 1);
page.Elements.Add(pageOne);
page.Elements.Add(pageTwo);
document.Draw ("twoBox.pdf")
System.Diagnostics.Process.Start("twoBox.pdf")
Re: PDF as background for another PDF
Support · Apr 23, 2009Hello,
Yes, in order to add one PDF page to another you will have to use the ImportedPageData or ImportedPageArea classes. You can refer to the Placing Imported Pages
and Importing Pages
topics on our help documentation.
Thanks,
ceTe Software Support Team.
Re: PDF as background for another PDF
Forum member · Apr 28, 2009Thanks for the Post. Great Help :)