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

DynaPDF Manual - Page 567

Previous Page 566   Index   Next Page 568

Function Reference
Page 567 of 750
mapping from user space to device space. The member PageSpace of the TPDFRasterImage structure
represents this mapping and must be passed to the parameter Matrix.
The function must be called within an open page and with the same Flags which were used in the
RenderPage() or RenderPageEx() call. The flags to exclude annotations or form fields from rendering
will be ignored.
To render the annotations and fields from a page, open the whished page with EditPage() and call
GetPageAnnotCount(). Now you can loop over the annotations from 0 to GetPageAnnotCount() - 1
with GetPageAnnotEx(). A form field is an annotation of the type atWidget.
The member StructSize of the structure TPDFBitmap must be set to sizeof(TPDFBitmap) before the
function can be called.
The members DestX, DestY define the destination position on the rendered page image. The position
is returned in top down coordinates and measured in pixels. Note that annotations and form fields
can occur outside the visible area of a page.
If the coordinates of the page were translated, this is the case if the x or y members of the matrix
were non-zero when rendering the page, then this offset must be added to the returned destination
out.DestX += (SI32)img.Matrix.x;
out.DestY += (SI32)img.Matrix.y;
Since the matrix is already defined in device coordinates, no further math is required to calculate the
correct destination position.
Note that annotations and form fields can contain transparent areas. The pixel format should contain
an alpha channel so that it can be correctly blended on the page image.
The Button State (parameter State)
Only form fields support different appearance states. Annotations use always the up state. If no
appearance stream is defined for a specific state then the normal appearance will be returned. Check
boxes contain mostly four different appearance streams: two for the up state and two for the down
state. The function selects the appearance stream for a specific state depending on the field value.
Therefore, all four appearances can only be rendered, if the field value will be changed from checked
to unchecked or vice versa.
Raw image output
By default, annotations or form fields are rendered into a raw memory buffer that is returned in the
TPDFBitmap structure. The image buffer can be released with FreeImageBuffer() when it is no longer
needed. It is not required to release the image buffer every time before the next annotation or field
can be rendered but previously returned pointers become invalid once the next image was rendered.
After the last annotation was rendered, the image buffer should be released with FreeImageBuffer().

Previous topic: RenderAnnotOrField

Next topic: How to create image files