Xojo Conferences
MBSOct2019CologneDE

DynaPDF Manual - Page 216

Previous Page 215   Index   Next Page 217

Function Reference
Page 216 of 767
}
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);
pdfAppend(pdf);
// 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
f
= pdfCreateButton(pdf, "Reset", "Reset", -1, 250, 50, 100, 20);
act = pdfCreateResetAction(pdf);
pdfAddActionToObj(pdf, otField, oeOnMouseUp, act, f);
w = 200.0f; // Field width
h = 200.0f; // Field height
// Initialize the structure with zero
memset(&b, 0, sizeof(b));
b.StructSize
= sizeof(TPDFFieldEx); // Required!
b.ECC
= 5.0f;
b.Height
= h / 72.0f;
b.nCodeWordCol = 10.0f;
b.nCodeWordRow = 90.0f;
b.Resolution
= 300;
b.Symbology
= "PDF417";
b.Version
= 1.0f;
b.Width
= w / 72.0f;
b.XSymHeight
= 8.0f;
b.XSymWidth
= 4.0f;
f = pdfCreateBarcodeField(pdf, "Barcode", -1, 50.0, 200.0, w, h, &b);
// Generic script to update the barcode
char updateBarcode[] =
"function strTabDelimited(oParam)\n"
"{\n"
" var bNeedTab = false;\n"
" var strNames = \"\";\n"
" var strValues = \"\";\n"
 

Previous topic: CreateBarcodeField

Next topic: CreateButton