Combine PDF in COM/ActiveX
How to Combine PDFs?
Combining PDFs together with DynamicPDF Merger is simple. Below are steps and sample code showing how to combine three PDF documents into one.
Steps to Combine PDF Files
- Create a
Documentobject by passing the first PDF file. - Call the
AppendPdfmethod with the second PDF file. - Repeat the call to the
AppendPdfmethod any number of times depending on the number of PDFs you need to combine. Optionally you an also specify the pages from the PDF to be appended. - Output the
Documentto the Browser.
Sample code - ASP
Dim MyDocument
Set MyDocument = Server.CreateObject("DynamicPDF.Document")
MyDocument.LoadPdf Server.MapPath("DocumentA.pdf")
MyDocument.AppendPdf Server.MapPath("DocumentB.pdf"), 1, 2
MyDocument.AppendPdf Server.MapPath("DocumentC.pdf")
MyDocument.DrawToWeb
Combine PDFs by Specifying Options
Steps to Combine PDFs
- Create a
MergeOptionsobject. - Set the options as per your requirement. In the example, we set FormFields to false, so form fields are not appended.
- Pass the
MergeOptionsobject into theAppendPdfmethod.
Sample code - ASP
'Specify the options
Dim MgOptions
Set MgOptions = Server.CreateObject( "DynamicPDF.MergeOptions" )
MgOptions.MergeFormFields = False
MyDocument.AppendPdf "DocumentC.pdf", , , MgOptions
Getting Started
DynamicPDF Merger Information
More information can be found here:
Available in Other Platforms
DynamicPDF Merger PDF Library is available for .NET and Java platforms. Refer to the respective product pages for more details.
- .NET - DynamicPDF Merger for .NET
- Java - DynamicPDF Merger for Java