Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

DynaPDF Manual - Page 552

Previous Page 551   Index   Next Page 553

Function Reference
Page 552 of 750
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.
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0.
PlaceTemplateEx
Syntax:
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
ImportPageEx().
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:
 

Previous topic: PlaceTemplate

Next topic: PlaceTemplByMatrix