DynamicPDF Merger for COM/ActiveX is designed to allow highly efficient reuse of imported PDF document data. The PdfDocument class is included for this purpose. This class holds the pages and resources of a PDF document and can be used in the MergeDocument, ImportedPage and ImportedPageData as well as the Append method of MergeDocument. Using a PdfDocument object optimizes performance by minimizing the number of times that PDF data needs to be parsed and allowing for the efficient reuse of shared PDF resources.
PdfDocument objects are thread safe and can be added set to a Shared member variable of your class. This shared member variable can then be used wherever the document or pages from the document are needed. This is highly recommended for documents, or pages from documents, such as templates or cover pages, which will be reused many times in your application.
IMPORTANT: A PdfDocument class can be used anywhere a file path to an existing PDF document can be specified such as the MergeDocument, ImportedPage and ImportedPageDataas well as the Append method of MergeDocument. The overloads of those methods allow PDFs to be specified by file path for convenience. PDFs should only be specified by file path there if they are not going to be reused.
The following example shows how to most efficiently reuse a template page and PDF document in your class.
[ASP - VBScript]
<!-- METADATA TYPE="typelib" UUID="{DF9225FE-94A4-490D-8CAD-E8366CE621D3}"-->
<%
Dim Pdf
Set Pdf = Server.CreateObject( "DynamicPDF.PdfDocument")
Pdf.LoadPdf ("C:\AllPageElements.pdf")
Dim Pdf1
Set Pdf1 = Server.CreateObject( "DynamicPDF.PdfDocument")
Pdf1.LoadPdf ("C:\AllPageElements1.pdf")
Dim MyDocument
Set MyDocument = Server.CreateObject( "DynamicPDF.Document")
MyDocument.AddImportedPage Pdf, 1
Dim MyPage
Set MyPage = MyDocument.AddPage()
Dim MyLabel
Set MyLabel = MyPage.AddLabel("FullName", 0, 0, 200, 12)
MyDocument.AppendPdf (Pdf1)
' Draw the PDF
MyDocument.DrawToWeb
Set MyDocument = Nothing
%>