DynaPDF Manual - Page 520
Previous Page 519 Index Next Page 521
Function Reference
Page 520 of 839
However, the normalized form is used in 99% of all available documents but it is also possible that a
document uses a non-normalized form. For instance, the media box can look like this:
mediabox.Left
= -100.0; // lower-left x
mediabox.Bottom = -100.0; // lower-left y
mediabox.Right
=
200.0; // upper-right x
mediabox.Top
=
200.0; // upper-right y
The size of the page that uses such a bounding box is 300 x 300 units. The problem is that the
coordinate origin lies at -100, -100. The page can also contain a crop box and the original page can be
rotated. This makes the handling more complicated.
When placing such a template with PlaceTemplate() on a page without further considerations the
result will be wrong because PlaceTemplate() does not consider the coordinate origin or the original
page orientation.
To simplify the work with imported templates PlaceTemplateEx() should be used instead. This
function considers the coordinate origin, crop box, and it preserves the original orientation when the
template is placed on a page. See PlaceTemplateEx() for further information.
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.
ImportPageEx
Syntax:
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().
Previous topic: ImportPage, Bounding boxes
Next topic: Calling the function inside of an open page, Calling the function outside of an open page