DynaPDF Manual - Page 665

Previous Page 664   Index   Next Page 666

Function Reference
Page 665 of 839
not included in the font, the string looks misplaced and unsupported characters will be replaced
with the .notdef character when viewing the file.
Strings of CID fonts cannot be replaced with this function because such strings are binary strings
which cannot be created outside of the library.
However, it is usually best to use this function to delete the original string if necessary. The new text
can be written with the function WriteTextMatrixEx() or use ReplacePageTextEx() instead.
If a text record consists of more than one kerning record, it is possible to preserve an arbitrary
number of kerning records from deletion. This can be archieved by setting the member
DeleteKerningAt of the structure TPDFStack to the wished kerning record number before calling this
function. All kerning records above this number will be deleted. Note that the parameter NewText is
ignored in this case.
DynaPDF is delivered with the example edit_text which demonstrates how texts can be replaced in
a document. If you want to develop a text replacement algorithm please take a look into this
example.
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0.
ReplacePageTextEx
Syntax:
LBOOL pdfReplacePageTextEx(
const PPDF* IPDF,
// Instance pointer
const char* NewText,
// New text or NULL to delete the string
struct TPDFStack* Stack) // Operation stack
The function deletes or replaces a text string of a content stream that was found by the function
GetPageText() beforehand. The function requires a font that must be set with SetFont() or
SetFontEx() before calling this function. The new text is internally written with the function
WriteTextMatrixEx().
This function changes certain members of the graphics state such as the fill and stroke color, the
color space and the text draw mode. If further contents must be written to the file make sure that the
color space, text draw mode, and the wished fill and stroke color is initialized with the wished
values before writing new contents to the file.
DynaPDF is delivered with the example edit_text which demonstrates how texts can be replaced in
a document. If you want to develop a text replacement algorithm please take a look into this
example.
Remarks:
This function is implemented in an Ansi and Unicode compatible version.
 

Previous topic: ReplaceImageEx, ReplacePageText

Next topic: ResetAnnotAP, ResetEncryptionSettings, ResetLineDashPattern