DynaPDF Manual - Page 572

Previous Page 571   Index   Next Page 573

Function Reference
Page 572 of 777
Templates can be used multiple times on different pages or positions and with different sizes. Unlike
images, a template can be scaled without losing quality as far as the template contains vector
graphics and text objects only.
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
If Width or Height is 0, the missing value is calculated in relation to the given value of Height
or Width to preserve the template's aspect ratio. The resulting output is a template with exact
proportions relative to its original size.
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

Previous topic: PlaceSigFieldValidateIcon, PlaceTemplate

Next topic: PlaceTemplByMatrix