Draws a page from one PDF document onto the current page of this document.

 

   

Syntax
 

ID = Doc.AddImageDoc(Source, Page , SrcRect)

 

   

Params
 
Name Type Description
Source Doc The source document.
Page Long The page number of the source page you want drawn. Use one to indicate the first page.
SrcRect String

The portion of the page you want drawn. Use an empty string to specify the rectangle encompassing the entire page.

The format of this string should be the same as that obtained via the XRect.String property.

ID Long The ID of an implementation-dependent object.

 

   

Notes
 

Draws a page from one PDF document onto the current page of this document.

The page is scaled to fill the current Rect. It is transformed using the current Transform.

If the width or height of the current rectangle is zero, the image is auto-sized. If you are working in TopDown mode, the image is positioned with its top left pinned at the location indicated by the rectangle. If you are not in TopDown mode, the bottom left of the image is pinned at the location indicated by the rectangle. In both cases, the natural dimensions of the supplied image are used to determine the displayed width and height resulting in a 72-dpi output.

 

   

Example
 

This example shows how to draw one PDF into another. It takes a PDF document and creates a 'four-up' summary document by drawing four pages on each page of the new document.

First, we create an ABCpdf Doc object and read in our source document.

Set theSrc = Server.CreateObject("ABCpdf10.Doc")
theSrc.Read "c:\mypdfs\spaceshuttle.pdf"
theCount = theSrc.PageCount

Next, we create a destination Doc object and set the MediaBox so that the page size will match that of the source document. We change the rect so that it occupies a quarter of the page with room to accommodate a small margin.

Set theDst = CreateObject("ABCpdf10.Doc")
theDst.MediaBox = theSrc.MediaBox
theDst.Rect = theDst.MediaBox
theDst.Rect.Magnify 0.5, 0.5
theDst.Rect.Inset 10, 10
theX = theDst.MediaBox.Width / 2
theY = theDst.MediaBox.Height / 2

We go through every page in the source document drawing a framed copy of each page at a different position on our four-up document. After every fourth page, we add a new page into our destination document.

For i = 1 To theCount
  theItem = i Mod 4
  If theItem = 1 Then
    theDst.Page = theDst.AddPage()
    theDst.Rect.Position 10, theY + 10
  ElseIf theItem = 2 Then
    theDst.Rect.Position theX + 10, theY + 10
  ElseIf theItem = 3 Then
    theDst.Rect.Position 10, 10
  ElseIf theItem = 0 Then
    theDst.Rect.Position theX + 10, 10
  End If
  theDst.AddImageDoc theSrc, i, ""
  theDst.FrameRect
Next

Finally, we save.

theDst.Save "c:\mypdfs\fourup.pdf"

We get the following output.


fourup.pdf [Page 1]

fourup.pdf [Page 2]