So I've created a MS Access database to dynamically create PDF questionnaire forms for different organizations in my company which get filled out by a interviewer and then ingested back into the Access database to generate statistics.
The problem is that the base template PDF for the questionnaires has all of the logos for the different orgs embedded onto the form which in turn gets transferred down to all the questionnaires that get created. That means a full megabyte of space being put to waste per new questionnaire. Now I'm looking into alternative routes other than storing all these questionnaires, but for now I'm hoping to find a way to delete the unused logos.
Below is my attempt but it's doesn't seem to be working because the file size remain the same when a new questionnaire is created. Can anyone tell me where I'm going wrong? I suspect it's with this line " xfa.form.form1.Page1.Header.nodes.remove(delArray.pop()); " but I'm not sure how it should be formatted.
function changeLogo(logoID){
var hNodes = form1.Page1.Header.nodes;
var logoName = "";
switch(logoID){
case 1:logoName = "parentOrg";break;
case 2:logoName = "org1";break;
case 3:logoName = "org2";break;
case 4:logoName = "org3";break;
case 5:logoName = "org4";break;
}
var delArray = [];
for(var i = 0; i < hNodes.length;i++){
var tNode = hNodes.item(i);
if (tNode.ui.oneOfChild.className == "imageEdit"){
if (tNode.name == logoName){
tNode.presence = "visible";
}else{
delArray.push(tNode);
}
}
}
while(delArray.length > 0){
xfa.form.form1.Page1.Header.nodes.remove(delArray.pop());
}
}
Much appreciate any help I can get.
Sincerely,
Jake