DynaPDF Manual - Page 232

Previous Page 231   Index   Next Page 233

Function Reference
Page 232 of 818
CreateBarcodeField
Syntax:
SI32 pdfCreateBarcodeField(
const PPDF* IPDF,
// Instance pointer
const char* Name,
// Field name
SI32 Parent,
// Parent field or -1
double PosX,
// X-Coordinate of the barcode field
double PosY,
// Y-Coordinate of the barcode field
double Width,
// Width in unscaled units
double Height,
// Height in unscaled units
struct TPDFBarcode* Barcode) // see below
struct TPDFBarcode
{
UI32
StructSize;
// Must be set to sizeof(TPDFBarcode)
const char* CaptionA;
// Optional
const UI16* CaptionW;
// Optional
float
ECC;
// 0..8 for PDF417, or 0..3 for QRCode
float
Height;
// Height in inches (field height / 72.0)
float
nCodeWordCol; // Number of codewords per barcode coloumn
float
nCodeWordRow; // Codewords per barcode row (PDF417)
UI32
Resolution;
// Resolution
const char* Symbology;
// Must be PDF417, QRCode, or DataMatrix
float
Version;
// Should be 1
float
Width;
// Width in inches (field width / 72.0)
float
XSymHeight;
// Only needed for PDF417. The vertical distance between two barcode
// modules, measured in pixels. The ratio XSymHeight / XSymWidth shall
// be an integer value. For PDF417, the acceptable ratio range is from
// 1 to 4. For QRCode and DataMatrix, this ratio shall always be 1.
float
XSymWidth;
// The horizontal distance, in pixels, between two barcode modules.
};
The function creates a barcode field.
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
calculated.
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.
 

Previous topic: CreateAxialShading

Next topic: CreateButton


Start Chat