DynaPDF Manual - Page 624
Previous Page 623 Index Next Page 625
Page 624 of 821
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 wished 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
Note that the return value of the function must be zero, otherwise no image will be returned. See
Return values at the end of the function description.
Previous topic: RenameSpotColor, RenderAnnotOrField
Next topic: How to create image files