ImportedPageArea Class | ImportedPageData Class | Programming with Merger FOR COM/ActiveX

The ImportedPageArea and ImportedPageData classes can be used to create a page element out of the data from a page in an existing PDF document. This can then be rotated, scaled, or clipped and placed on a Page .

The following code will import two pages and place them side by side on a new page.

[ASP - VBScript]
<!-- METADATA TYPE="typelib" UUID="{DF9225FE-94A4-490D-8CAD-E8366CE621D3}"-->
<%
    Dim MyDocument
    Set MyDocument = Server.CreateObject( "DynamicPDF.Document" )
    MyDocument.DefaultPageWidth = 1200
    MyDocument.DefaultPageHeight = 800
    Dim MyPage
    Set MyPage = MyDocument.AddPage()
    MyPage.AddImportedPageData Server.MapPath( "PDFs/DocumentA.pdf" ), 1, -306, 0
    MyPage.AddImportedPageData Server.MapPath( "PDFs/DocumentA.pdf" ), 2, 306, 0
    MyDocument.DrawToWeb
    Set Mypage = Nothing
    Set MyDocument = Nothing
%>

 

The following code will import and clip a page and place it on a new page.

[ASP - VBScript]
<!-- METADATA TYPE="typelib" UUID="{DF9225FE-94A4-490D-8CAD-E8366CE621D3}"-->
<%
    Dim MyDocument
    Set MyDocument = Server.CreateObject( "DynamicPDF.Document" )
    MyDocument.DefaultPageWidth = 1200
    MyDocument.DefaultPageHeight = 800
    Dim MyPage
    Set MyPage = MyDocument.AddPage()
    Dim MyImportedPageArea
    Set MyImportedPageArea = MyPage.AddImportedPageArea( Server.MapPath( "PDFs/DocumentA.pdf" ), 1, 0, 0, 50 )
    MyImportedPageArea.Contents.ClipLeft = 100
    MyImportedPageArea.Contents.ClipTop = 100
    MyImportedPageArea.Contents.ClipRight = 100
    MyImportedPageArea.Contents.ClipBottom = 100
    MyDocument.DrawToWeb
    Set MyPage = Nothing
    Set MyDocument = Nothing
%>

Page Content Reuse

when adding a ImportedPageArea or a ImportedPageData, the imported page content is reused in case of the imported document being used again to prevent the page contents from being embedded in the document multiple times and the data will be shared, reducing the overall size of your document.

See Also 

ImportedPageArea Class | ImportedPageData Class | Programming with Merger FOR COM/ActiveX