DynaPDF Manual - Page 586
Previous Page 585 Index Next Page 587
Page 586 of 821
The coordinates of a page extend from left to right and from bottom to top (subject to alteration by
the orientation of the page (see GetOrientation()). Note that SetPageCoords() does not affect the
coordinates returned by the content parser.
The length of a unit in default user space is 1/72 inch. The visible area of a page is defined by the
crop box of the page, or if absent, by the media box (see GetBBox() for further information). The
media box represents the coordinate system in which the page is defined.
In addition to user space, PDF uses a variety of other coordinate spaces for specialized purposes:
Text coordinates are defined in text space. The transformation from text space to user space
is defined by a text matrix which is provided in the text callback functions. PDF defines also
several text related positioning parameters in the graphics state. However, to make the usage
easier DynaPDF pre-computes the text transformation matrix so that no further calculations
are required to transform the text space to user space. Note that the current leading, which
specifies the distance between two text lines, is already considered in the text matrix. The
text matrix is always provided. To transform text space to user space the text matrix must be
multiplied with the one of the current graphics state.
Images are defined in image space. An image in PDF is always one unit wide and one unit
high in user space, regardless of the number of samples in the image. The mapping to the
visible region in user space is achieved by temporarily altering the current transformation
matrix. The image position, as well as the width and height must be computed from the
current transformation matrix (take a look at the description of the TInsertImage callback
function for further information).
Templates (Form XObjects in PDF terms) are defined in form space. The transformation from
form space to user space is defined by a form matrix that is provided in the TBeginTemplate
callback function. However, the matrix parameter of the callback function is optional and can
be set to NULL. Null means the matrix is set to the identity matrix. To transform form space
to user space the form matrix must be multiplied with the one of the current graphics state.
Patterns are defined in pattern space. The transformation from pattern space to the initial
default user space of the object in which it is used is provided in the TBeginPattern callback
function. However, the matrix parameter of the callback function is optional and can be set
to NULL. Null means the matrix is set to the identity matrix. Note that patterns are treated
like a color. The TBeginPattern callback function starts the definition of the pattern and
activates it in the graphics state when the corresponding TEndPattern callback function is
executed. However, a pattern is applied when the next fill or stroke path operation occurs
and if the pattern was defined as fill or stroke color.
o If a pattern is used on a page, the pattern matrix maps pattern space to the default
(initial) coordinate space of the page. Changes to the page’s transformation matrix
that occur within the page’s content stream, such as rotation and scaling, have no
Previous topic: The Graphics State
Next topic: Working with Transformation Matrices