Copy link to clipboard
Copied
Dear all:
After filling the fields in the dynamic form, without touching and changing the master form. I want to use "PDF Printer" to save as a new purely static document cleared of the JavaScript codes which is embedded, by changing the file name from the reference field information (ex.DocumentNumber+DocumentDate). I want to assign a button to all these and use the following User level and button level code combination.
This is JavaScript for User Level
// JavaScript of Silent Print for Folder Level
sPrint = app.trustedFunction(function(doc) {
app.beginPriv();
var pp = doc.getPrintParams();
bUI: true
pp.interactive = pp.constants.interactionLevel.automatic; // pp.interactive = pp.constants.interactionLevel.silent OR automatic;
pp.printerName = "PDF Printer";
doc.print(pp);
app.endPriv();
});
This is JavaScript for Button
// JavaScript For Button
// Add Stamp
this.addAnnot({type:"Stamp",AP:"#-_qO5DiVhB8W6rvdDCXd8D",page:this.pageNum,rect: [306,175,394,263],rotate: 8});
// Set the buttons to hidden
getField("function").display = display.noPrint;
getField("Approve").display = display.noPrint;
event.target.display = display.noPrint;
// Print
sPrint(this);
var annots=this.getAnnots();
for (i in annots) annots[i].destroy();
Flattening the fields will remove all code associated with them, and doc-level code can be removed using the removeScript method.
Copy link to clipboard
Copied
Not possible. You can't specify the file-name in your script when printing to the virtual Adobe PDF printer.
Copy link to clipboard
Copied
Dear @try67 ,
Thanks for your reply. Then how should we proceed for such a result? The file becomes static with the flattening command through the JavaScript, but how to remove the JavaScripts? Deleting scripts manually is not practical.
What is your suggestion?
Thanks and regards,
Copy link to clipboard
Copied
Flattening the fields will remove all code associated with them, and doc-level code can be removed using the removeScript method.