Xojo Conferences

DynaPDF Manual - Page 214

Previous Page 213   Index   Next Page 215

Function Reference
Page 214 of 766
The function creates a barcode field.
Note that users require either the full version of Adobe's Acrobat or a separate license of Adobe's
Barcodes Paper Forms Solutions to enable the usage of barcode fields in Adobe's Reader.
The structure TPDFBarcode must be fully initialized with correct values for the wished barcode type.
An example for the PDF417 barcode is provided below the function description. For other barcodes
please consult the correcponding barcode reference.
The value of a barcode field is normally dynamically set with a JavaScript action that is associated
with the OnCalc event of the barcode field. It is also possible to use a global JavaScript function or
other events depending on when the barcode should be updated or how the value must be
Because DynaPDF does not contain a barcode library it is recommended to set the the
NeedAppearance flag of the AcroForm to true (see SetNeedAppearance()). Alternatively barcodes
can be initialized with a JavaScript action, e.g. in the pages OnOpen event. Without initialisation the
barcode field appears as gray box on the page.
Barcode field require a specific set of field flags which must be present:
flags = ffPrint | ffReadOnly | ffNoExport | ffMultiline | ffDoNotSpellCheck;
DynaPDF sets the above flags when creating the field. Changing the field flags can cause errors in
Adobe's Acrobat or prevent that the barcode becomes rendered.
The parameter Name must be a unique name for the barcode field.
If the coordinate system is bottom-up the point PosX, PosY defines the lower left corner of the
barcode field. If the coordinate system is top-down it defines the upper left corner.
The barcode covers the entire visible area of the field. So, the field is rendered without a border.
Changing the border color or border width has no effect.
A barcode field is a text field that contains a barcode dictionary. When enumerating fields with
GetFieldEx() check whether IBarcode is set to determine whether the field is a barcode field or an
ordinary text field.
Return values:
If the function succeeds the return value is the field handle, a value greater or equal zero. If the
function fails the return value is a negative error code.
Example (C++):
// Error callback function
SI32 PDF_CALL PDFError(const void* Data, SI32 ErrCode,
const char* ErrMessage, SI32 ErrType)
printf("%s\n", ErrMessage);
return 0;

Previous topic: CreateBarcodeField

Next topic: CreateButton