DynaPDF Manual - Page 52

Previous Page 51   Index   Next Page 53

Content parsing & editing
Page 52 of 860
Content parsing & editing
DynaPDF contains a very powerful content parser that is already used since several years by
Optimize() and CheckConformance(). The very same parser can also be used to extract text, find
and replace text, delete arbitrary operators, convert text to outline, convert colors, or
downscaling and recompressing images, for example.
ParsePage() parses a page and creates a C object structure from it. This structure can be edited
with various functions like Find- / ReplaceText(), or by DeleteOperator(), for example. Note that
changes made on the C object structure do not take effect until the structure was written back
with WriteToPage().
Include files
The parser API is defined in the file parser_interface.h (C/C++) or CPDFContentParser.cls for
VB 6. Other programming languages do not need to include a separate file but the API is
encapsulated in the class CPDFContentParser(), or TPDFContentParser() in Delphi respectively
to make the usage easy as possible.
Abort
Syntax:
void psrAbort(
const IPSR* Ctx) // PDF instance pointer
The function can be used to abort parsing whenever needed. However, parsing can be aborted
only if ParsePage() was called in a separate thread. Note that it is not allowed to execute
different functions of the same PDF instance in different threads. Every thread requires either
its own PDF instance or function calls must be synchronized.
ChangeAltFont
Syntax:
LBOOL psrChangeAltFont(
const PPDF* IPDF, // PDF instance pointer
const IPSR* Ctx,
// Parser instance pointer
UI32 Handle)
// Font handle
The function changes the active alternate font that is used by ReplaceSelText() when the original
font is not available. The font handle must be a handle that was returned by SetFont(),
SetFontEx(), SetCIDFont(), or SetAltFont().
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0.
 

Previous topic: Compiling DynaPDF on macOS, Compiling with XCode, Compiling on the Command Line

Next topic: ClearSelection, CreateParserContext