DynaPDF Manual - Page 560

Previous Page 559   Index   Next Page 561

Function Reference
Page 560 of 787
The Graphics State
An application that uses the content parser must maintain an internal graphics state stack that stores
the current graphics state in a LIFO (last in first out) data structure. Depending on what kind of
information should be extracted only a few members of the graphics state maybe required. For
example, an application that extracts text from a PDF file can ignore path painting parameters like
the current line cap style, line width and so on.
A complete graphics state contains the following variables:
Parameter
Type
Initial Value
CharSpacing
float
0.0f
Clipping Path
Vector array
Crop box or Media box
DashPattern
float*
NULL (Solid line)
DashPhase
UI32
0
FillColor
double[32]
Black
FillColorSpace
TExtColorSpace, IColorSpace*
esDeviceGray, NULL
FillPattern
IPattern*
NULL
Font
IFont*
NULL
FontSize
double
0.0
FontType
TFontType
-
Leading
float
0.0f (Info only, see below)
LineCapStyle
TLineCapStyle
csButtCap
LineJoinStyle
TLineJoinStyle
jsMiterJoin
LineWidth
float
1.0f
Matrix
TCTM
{1, 0, 0, 1, 0, 0}
MiterLimit
float
10.0f
StrokeColor
double[32]
Black
StrokeColorSpace
TExtColorSpace, IColorSpace*
esDeviceGray, NULL
StrokePattern
IPattern*
NULL
TextDrawMode
TDrawMode
dmNormal
TextScale
float
100.0f
WordSpacing
float
0.0f
The current graphics state must be initialized with the above default values before parsing a new
page. Templates (Form XObjects in PDF terms) inherit the graphics state of the parent object that
paints the template.
The parameter Leading is provided for information only because it is already considered in the text
matrix of all text callback functions (see Coordinate Spaces for further information).
The variables which make up the graphics state are normally stored in a structure or class so that the
graphics state can be saved and restored if corresponding operators are executed.
If the TSaveGraphicState callback function is executed, the application must create a copy of the
current graphics state and push it onto the graphics state stack. In the corresponding
TRestoreGraphicState callback function, the last element of the graphics state stack must be popped
and copied to the current graphics state.
 

Previous topic: ParseContent

Next topic: Coordinate Spaces

Start Chat