Patial import of a PDF form using javascript
Hi,
I need some help on a javascript implementation. that will allow to import the data from fields from a previously filled PDF form.
But... after hours trying to use opendoc in hidden ... my "target" document always remain "undefined"
trying with oDoc ... same .
i'm out of ideas... anyone here that would have succesfully implemented this kind of function ?
I am doing the below :
function importPDF(introFields) {
try {
var d = myTrustedBrowseForDoc();
// console.println(d.toSource());
console.println(d.cPath);
var oldfilepath = d.cPath;
// open the documen as a hidden document
try {
var sourceDoc = app.openDoc({cPath:oldfilepath, bHidden:true});
}
catch (e) {
console.println("Error opending doc" + e);
}
// import the data in the intro section
// copy the data from oDoc to this
for (var i=0; i<introFields.length; i++) {
var theName = introFields[i];
try {
var oldValue = sourceDoc.getField(theName).value;
this.getField(theName).value = oldValue;
}
catch (e) {
console.println("ERROR on Import: " + theName + " - " + e);
}
}
oDoc.closeDoc();
} catch(e) {
console.println("User cancelled Save As dialog box");}}Any suggestion on what i'm doing wrong... is welcome !
