DynaPDF Manual - Page 241

Previous Page 240   Index   Next Page 242

Function Reference
Page 241 of 839
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;
SI32 TestBarcode(void)
float w, h;
TPDFBarcode b;
SI32 retval, f, act;
PPDF* pdf = pdfNewPDF();
if (!pdf) return -1; // Out of memory?
pdfSetOnErrorProc(pdf, NULL, PDFError);
pdfCreateNewPDF(pdf, "barcode.pdf");
pdfSetPageCoords(pdf, pcTopDown);
// Two text fields to enter some test data...
pdfCreateTextField(pdf, "Name", -1, false, -1, 50, 50, 150, 20);
pdfCreateTextField(pdf, "Email", -1, false, -1, 50, 80, 150, 20);
// A button to reset the form
= pdfCreateButton(pdf, "Reset", "Reset", -1, 250, 50, 100, 20);
act = pdfCreateResetAction(pdf);
pdfAddActionToObj(pdf, otField, oeOnMouseUp, act, f);

Previous topic: CreateBarcodeField

Next topic: CreateButton