Skip to main content

Merge PDF in COM/ActiveX

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​

  1. Create a Document object and Load the first PDF.
  2. Append the second PDF.
  3. Output the Document to 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​

  1. If you would like to specify different options, then create a MergeOptions object.
  2. Modify the options as per requirement. In the example, the Outlines is set to false.
  3. Pass the MergeOptions object into the AppendPdf method.

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.