DynaPDF Manual - Page 242

Previous Page 241   Index   Next Page 243

Function Reference
Page 242 of 839
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"
" for (var i = 0; i < oParam.oDoc.numFields; ++i)\n"
"
{\n"
"
var strFieldName = oParam.oDoc.getNthFieldName(i);\n"
"
var f = oParam.oDoc.getField(strFieldName);\n"
"
if (f != oParam.oTarget && f.type != \"button\")\n"
"
{\n"
"
if (bNeedTab)\n"
"
{\n"
"
if (oParam.bFieldNames)\n"
"
strNames += \"\\t\";\n"
"
strValues += \"\\t\";\n"
"
}\n"
"
if (oParam.bFieldNames)\n"
"
strNames += strFieldName;\n"
"
strValues += f.value;\n"
"
bNeedTab = true;\n"
"
}\n"
"
}\n"
"
if (oParam.bFieldNames)\n"
"
return strNames + \"\\n\" + strValues;\n"
" else\n"
"
return strValues;\n"
"}\n"
"try\n"
 

Previous topic: CreateBarcodeField

Next topic: CreateButton