DynaPDF Manual - Page 582

Previous Page 581   Index   Next Page 583

Function Reference
Page 582 of 787
PlaceTemplate
Syntax:
LBOOL pdfPlaceTemplate(
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
ImportPageEx().
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
template.
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
mirrored).
A negative value of Width or Height mirrors the template on the x- or y-axis.
Notice:
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.
Remarks:
A template is invisible as long it was not placed on a page, template, or pattern.
 

Previous topic: PlaceSigFieldValidateIcon

Next topic: PlaceTemplateEx

Start Chat