Xojo Conferences
MBSOct2019CologneDE

DynaPDF Manual - Page 541

Previous Page 540   Index   Next Page 542

Function Reference
Page 541 of 766
The content parser is not part of the Visual Basic interface due to the bad support for callback
functions. Preferred programming languages are C/C++, C#, Delphi, or VB .Net. These programming
languages offer optimal execution speed and the usage is relatively simple. Although .Net languages
support no pointers the execution speed is almost identically to C/C++ or Delphi.
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
double*
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
 

Previous topic: ParseContent

Next topic: Coordinate Spaces