Merge PDF in COM/ActiveX
DynamicPDF makes Merging PDFs together easy. Here are some examples on the basic steps and how to specify what data is merged by using merge options.
How to Merge PDF Files
Below are the steps and sample code to merge PDF files with and without options.
Steps to Merge PDFs
- Create a
Documentobject and Load the first PDF. - Append the second PDF.
- 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")
MyDocument.DrawToWeb
If you have additional PDFs to merge, you can append them by calling the Append method.
Sample Code with Append - ASP
Dim MyDocument
Set MyDocument = Server.CreateObject("DynamicPDF.Document")
MyDocument.LoadPdf Server.MapPath("doc-a.pdf")
MyDocument.AppendPdf Server.MapPath("doc-b.pdf"), 1, 2
MyDocument.AppendPdf Server.MapPath("doc-c.pdf")
MyDocument.DrawToWeb
Specifying The Type of Content to Be Merged
- If you would like to specify different options, then create a
MergeOptionsobject. - Modify the options as per requirement. In the example, the Outlines is set to false.
- Pass the MergeOptions object into the
AppendPdfmethod.
Sample Code for MergeOptions - ASP
Dim MgOptions
Set MgOptions = Server.CreateObject( "DynamicPDF.MergeOptions" )
MgOptions.Outlines = False
MyDocument.AppendPdf "DocumentC.pdf", , , MgOptions
Getting Started
DynamicPDF Merger Information
More information can be found here:
Available on 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