DynaPDF Manual - Page 774

Previous Page 773   Index   Next Page 775

Function Reference
Page 774 of 818
SetTextFieldValue
Sytnax:
SI32 pdfSetTextFieldValue(
const PPDF* IPDF,
// Instance pointer
UI32 Field,
// Text field handle
const char* Value,
// Field's value or NULL
const char* DefValue, // Field's default value or NULL
TTextAlign Align)
// Text alignment
The function sets or changes the value and default value of a text field. The parameters Value and
DefValue can both be NULL, if both values should be deleted. The parameter DefValue defines the
default value of the field, this value is shown in Adobe's Acrobat as long as the field has no value; it
will be hidden when entering the field.
The strings are drawn with the font that is associated with the field. The font size is taken from the
field settings. If set to “auto”, the font size is computed from the field’s bounding box.
Field format
Text fields can be formatted to certain number formats with Javascript actions that are executed in
the OnFormat event. DynaPDF has limited support for the Javascript functions AFNumber_Format(),
AFPercent_Format(), and AFSpecial_Format().
However, the results of number formats of Adobes Acrobat and DynaPDF are sometimes slightly
different. It is not known whether this is a Javascript or Acrobat issue, but the results shown below
can be reproduced with all known Acrobat versions.
Example number format with two fractional digits:
Value
Acrobat
DynaPDF
1.45499
1.45
1.45
1.454991
1.46
1.45
1.4549901
1.46
1.45
1.45499001
1.46
1.45
5.0049
5.00
5.00
5.00499
5.01
5.00
5.004989
5.00
5.00
It is possible to deactivate all kinds of number formats by setting the flag gfDisableJavascript with
SetGStateFlags(). The appearance stream of text fields is then created with the raw field value.
Remarks:
This function is implemented in an Ansi and Unicode compatible version.
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0.
 

Previous topic: How to use text as clipping path?

Next topic: SetTextFieldValueEx, SetTextRect, SetTextRise


Start Chat