Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

DynaPDF Manual - Page 544

Previous Page 543   Index   Next Page 545

Function Reference
Page 544 of 750
TRestoreGraphicState
As the name of the function suggests the graphics state must be restored when the callback function
is executed. The graphics state stack is a LIFO (last in first out) data structure that stores copies of the
graphics state. The last element from the graphics state stack must be popped and the values must be
copied to the current graphics state.
It is guaranteed that this function is not executed without a preceeding TSaveGraphicState call.
Invalid restore graphics state operators are trated as an error. The parser breaks processing when it
encounters such an error.
The return value of the function must be zero. Any other return value breaks processing.
TSaveGraphicState
As the name suggests the current graphics state must be saved when the callback function is
executed. As already described at TRestoreGraphiState the graphics state stack is a LIFO (last in first
out) data structure that stores copies of the graphics state. The application must create a copy of the
current graphics state and push it onto the graphics state stack.
It is not guaranteed that all saved graphics states will be restored until the page was fully parsed.
The application must make sure that remaining copies of the graphics state will be released before
parsing the next page or terminating the application.
The return value of the function must be zero. Any other return value breaks processing.
TShowTextArrayA
This is the preferred callback function to develop text search algorithms. See also Sub string
coordinates for further information. The function returns the source strings which can be converted
to Unicode with TranslateRawCode(). TranslateRawCode() converts the source string on a per
character basis and calculates the width of that character in one pass.
The parameter Width represents the width of the entire text record. The source array provides also
the displacement vector Advance. Advance is a vector also if only coordinate is given; the y-
coordinate is always zero. Positive values of Advance move the cursor to the left; negative values
move it to the right in a non-rotated coordinate system. The string widths and the displacement
vector are measured in text space.
The displacement vector is often used to apply kerning between two characters but it can also be
used to emulate spaces or to move the cursor to an arbitrary position on the x-axis of the text line.
Because CID fonts do not support word spacing, spaces are very often emulated with the
displacment vector.
The source strings are not null-terminated. The array can also contain strings with zero length. In
this case only the displacement vector Advance must be considered.
DynaPDF is delivered with the example text_search which demonstrates how a text search algorithm
can be developed. This project should be used as basis to develop your own code.
 

Previous topic: TSetFont

Next topic: Image Extraction