Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
DynaPDF.PlaceTemplateEx
The function places a template on a page, another open template, or pattern.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
DynaPDF | 3.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "DynaPDF.PlaceTemplateEx"; PDF; TemplateHandle; X; Y; W; H ) More
Parameters
Parameter | Description | Example |
---|---|---|
The PDF reference returned from DynaPDF.New. | ||
TemplateHandle | The handle value returned from DynaPDF.ImportPageAsTemplate function. | $template |
X | The x coordinate. | $x |
Y | The y coordinate. Please notice that PDF coordinates start at bottom of page except you change that with DynaPDF.SetPageCoords functions. | $y |
W | The width of the destination rectangle. | $w |
H | The height of the destination rectangle. | $h |
Result
Returns OK or error message.
Description
The function places a template on a page, another open template, or pattern.The parameter TemplateHandle must be a valid template handle that was returned by DynaPDF.BeginTemplate, DynaPDF.ImportPageAsTemplate.
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 DynaPDF.ImportPageAsTemplate 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 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.
A template does not support a crop box or orientation angle. When placing a template on a page that was created from a PDF page, the coordinate origin must be adjusted according to the original media or crop box. In addition, the template must maybe be drawn into a clipping path (if the original page contained a crop box), and the template must maybe also be rotated so that the original orientation can be preserved.
All these considerations complicate the handling of imported templates. To make the usage of imported templates easier the function considers the coordinate origin, it draws the template automatically into a clipping rectangle if required, and it rotates the template according to the original page orientation.
The only thing that must be considered is that the original size of the template must be calculated from the crop box if present. In addition, the so computed width and height must be exchanged if the original page orientation was 90, -90, 270, or -270 degrees.
See also PlaceTemplateEx function in DynaPDF manual.
See also
- DynaPDF.BeginTemplate
- DynaPDF.CreateAnnotAP
- DynaPDF.DeleteTemplate
- DynaPDF.DeleteTemplateEx
- DynaPDF.ImportPageAsTemplate
- DynaPDF.New
- DynaPDF.PlaceTemplate
- DynaPDF.RotateTemplate
- DynaPDF.SetPageCoords
Example Databases
- DynaPDF/Apply Letter Paper to PDF
- DynaPDF/Convert to 2 Pages
- DynaPDF/Generate Previews
- DynaPDF/Place Template
- DynaPDF/Shrink PDF pages
Blog Entries
FileMaker Magazin
This function checks for a license.
Created 18th August 2014, last changed 22nd April 2015
