DynaPDF Manual - Page 573

Previous Page 572   Index   Next Page 574

Function Reference
Page 573 of 787
This callback function is executed when a Form XObject in PDF terms is painted (we call this object
type template in DynaPDF). The parameter BBox specifies the template's bounding box or visible
area measured in form space. The required mapping from form space to user space is specified by
the Matrix parameter (see also Coordinate Spaces). The Matrix parameter is optional and can be set
to NULL. In the latter case, the form matrix is set to the identity matrix.
If the form matrix is present then it must be multiplied with the current transformation matrix of the
graphics state as follows:
// m_GState represents the current graphics state
if (Matrix)
m_GState.Matrix = MulMatrix(m_GState.Matrix, *Matrix);
The corresponding TEndTemplate callback function is executed if the contents of a template were
fully processed. The definition of this callback function is optional because no specific code is
required to be executed.
Return values:
0 indicates success and processing continues.
1 means that the template should be skipped.
Any other return value breaks processing.
The TMulMatrix callback function is executed if the current transformation matrix must be
multiplied with a new one. When using the function MulMatrix() the matrix must be multiplied
with the one of the graphics state as follows:
// m_GState represents the current graphics state
m_GState.Matrix = MulMatrix(m_GState.Matrix, *Matrix);
The parameter Matrix is always set; it is not required to check whether the parameter is set to NULL.
The TSetFont callback function activates a font in the graphics state. The following variables of the
graphics state must be set when the callback function is executed:
m_GState.ActiveFont = Font;
= FontSize;
= Type;
m_GState.SpaceWidth = (float)(fntGetSpaceWidth(Font, FontSize) * 0.5);
The space width is required to construct text lines. It is usually best to use the half space width to
determine whether a space must be inserted at a specific position because many PDF fonts do not

Previous topic: Unicode conversion, External CMaps, Inside the Callback Functions

Next topic: TRestoreGraphicState, TSaveGraphicState, TShowTextArrayA

Start Chat