Question
Create QR code for each individual page in a document
I have a multi-page pdf template and I need to insert QR codes that encode the version of the document and the page. The version will be in a form field, so I was looking to use Javascript to encode these QR codes. However I can't get the code to pick the page number. Can you help me please?
Here is the code for the QR code field:
/* Customize: */
function bMemberOf(strName, aStrNames)
{
for (var nMembIdx in aStrNames)
{
if (strName == aStrNames[nMembIdx])
return true;
}
return false;
}
function strTabDelimited(oParam)
{
var bNeedTab = false;
var strNames = "";
var strValues = "";
for (var i = 0; i < oParam.oDoc.numFields; ++i)
{
var strFieldName = oParam.oDoc.getNthFieldName(i);
if ((null == oParam.aFields || bMemberOf(strFieldName, oParam.aFields))
&& (null == oParam.strXclField || strFieldName != oParam.strXclField)
&& (oParam.oDoc.getField(strFieldName).type != "button"))
{
if (bNeedTab)
{
if (oParam.bFieldNames)
strNames += "\t";
strValues += "\t";
}
if (oParam.bFieldNames)
strNames += strFieldName;
strValues += oParam.oDoc.getField(strFieldName).valueAsString;
bNeedTab = true;
}
}
if (oParam.bFieldNames)
return strNames + "\n" + strValues;
else
return "Document version " + strValues + " Page " currentPage;
}
try
{
if ( app.viewerVersion >= ADBE.PMD_Need_Version )
event.value = strTabDelimited({oDoc: this, aFields: ["Version"], bFieldNames: false});
else event.value = " ";
}
catch (e)
{
event.value = " ";
}