DynaPDF Manual - Page 519
Previous Page 518 Index Next Page 520
Function Reference
Page 519 of 839
ImportPage
Syntax:
SI32 pdfImportPage(
const PPDF* IPDF, // Instance pointer
UI32 PageNum)
// Page number
The function imports a page from an external PDF file and converts it to a template. The external
PDF file must be opened with OpenImportFile() or OpenImportBuffer() beforehand. The parameter
PageNum specifies the page number that should be imported; the first page has the number 1.
The conversion of pages to templates is required if an imported page should be scaled or placed on
a specific position or if an imported page should be used on more than one destination page, e.g. as
a custom page background.
However, in cases where the conversion of pages to templates is not necessary the usage of
ImportPageEx() within an open page is preferred. In this case it is also possible to import interactive
objects with the page such as annotations or form fields. Such objects cannot be imported with
ImportPage() because templates do not support interactive objects.
The new template is not placed on the current open page if any. To make the template visible the
template must be placed on a page or other template with PlaceTemplate() or PlaceTemplateEx().
The template can be used on arbitrary pages and arbitrary positions. It is also possible to scale a
template like an image. See PlaceTemplateEx() for further information.
Imported pages are often called watermark. A watermark is usually a simple text or some kind of
graphics that was imported from a PDF file. Such a graphics can be placed in background or in
foreground of a page. To place a template in background, add the template as first object to the
desired page. If the template should appear in foreground, add it as last object. The background of
an imported page is transparent as long as it doesn't contain any opaque objects which blank out the
entire background. Scanned images which are converted to PDF are often not transparent. Those
pages must be placed in background to avoid overlaying objects.
It is possible to import an external page outside of an open page, and it is also possible to import a
page outside of an open output PDF file. However, all templates will be deleted when CloseFile() is
called the next time. It is not possible to import an external page as template and hold it in memory
for use with more than one PDF file.
Bounding boxes
As mentioned earlier, imported pages are converted to templates by this function. A template has
only one bounding box, but a PDF page has 5 bounding boxes (see SetBBox() for a full explanation).
The most important bounding boxes are the media box and crop box of the original page.
A bounding box is defined as a rectangle giving the coordinates pair of diagonally opposite corners.
The media box of a page is usually expressed in a normalized form where the coordinates of the
lower-left point are set to 0.
Previous topic: ImportEncryptionSettings, ImportOCProperties
Next topic: ImportPageEx