DynaPDF Manual - Page 624

Previous Page 623   Index   Next Page 625

Function Reference
Page 624 of 839
If Width and Height are 0, the original size is used (same effect as -1 but the template is not
A negative value of Width or Height mirrors the template on the x- or y-axis.
Imported pages can contain non-normalized bounding boxes and the page can be rotated. The
coordinate origin, crop box, and rotation angle of a page must be considered when placing a
template on a page because templates do not support features like a crop box or individual
orientation. The required calculations to find the correct coordinate origin to de-rotate a
template are relatively complex. Therefore, DynaPDF provides the function PlaceTemplateEx()
which considers the coordinate origin, orientation, and crop box automatically.
PlaceTemplateEx() greatly simplifies the handling of templates. If possible, this function should
be used when working with imported pages.
A template is invisible as long it was not placed on a page, template, or pattern.
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0.
LBOOL pdfPlaceTemplateEx(
const PPDF* IPDF,
// Instance pointer
SI32 TmplHandle,
// Template handle
double PosX,
// X-Coordinate
double PosY,
// Y-Coordinate
double ScaleWidth,
// Scaled width
double ScaleHeight) // Scaled height
The function places a template on a page, another open template, or pattern. The parameter
TmplHandle must be a valid template handle that was returned by BeginTemplate(), ImportPage() or
The function was specifically designed to work with templates which were created from imported
pages. A PDF page is converted to a template if it was imported with ImportPage() or
ImportPageEx() outside of an open page.
The calculation of the width and height is the same as for images:
If Width or Height is -1 the function uses the mirrored original width or height from the

Previous topic: PlaceTemplate

Next topic: PlaceTemplByMatrix