DynaPDF Manual - Page 485

Previous Page 484   Index   Next Page 486

Function Reference
Page 485 of 777
Return values:
If the function succeeds the return value is a template handle, a value greater or equal zero. If the
function fails the return value is a negative error code.
SI32 pdfImportPageEx(
const PPDF* IPDF, // Instance pointer
UI32 PageNum,
// Page number
double ScaleX,
// Horizontal scaling factor (1.0 = no scaling)
double ScaleY)
// Vertical scaling factor (1.0 = no scaling)
The function imports a PDF page of an external PDF file incl. interactive objects such as annotations,
form fields and so on, if any. The external PDF must be opened with the function OpenImportFile()
or OpenImportBuffer() beforehand.
Link annotations and article beads are not imported by default because the destinations of such
annotations become invalid if the remaining pages are not imported in the same order as they
appeared in the original PDF file. Web links are affected too because it is not possible to distinguish
between a normal page link and web link annotations during import.
However, if you can make sure that all pages of a PDF file will be imported in the same order as in
the original file you can set the import flag ifAllPageObjects (see SetImportFlags()) to disable the
normal import behaviour. If this flag is set all annotation types will be imported. However, article
beads are always discarded by this function because these objects depend on other global objects
which cannot be resolved when importing pages manually. Article beads can only be preserved if
the entire PDF file is imported with ImportPDFFile().
The function can be used in two ways, inside an open page or outside.
Calling the function inside of an open page
If the function is called inside an open page, the external page will be imported and scaled by using
the scaling factors ScaleX and ScaleY, if the import flag ifImportAsPage is not set (see
SetImportFlags() for further information). All bounding boxes of the page will be scaled too and the
orientation will be set to the value of the source page.
An external page can only be scaled to an arbitrary format if it is converted to a template. This
conversion is done if the import flag ifImportAsPage is not set (default).
However, if a page must not be scaled or used as a template on multiple pages the flag
ifImportAsPage should be set to avoid the conversion of pages to templates. In this case, the scaling
factors will be ignored and the page is imported as is.
If an imported page contains a crop box (see GetBBox()) the property UseVisibleCoords can be used
to move all coordinates into the visible area of the crop box. If the property is true, all functions
consider the coordinate origin of the crop box to calculate the position of an object.

Previous topic: ImportPage, Bounding boxes

Next topic: Calling the function outside of an open page, ImportPDFFile