• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Silent Printing as a new document to local disk via "PDF Printer".

Explorer ,
Apr 24, 2022 Apr 24, 2022

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();

 

TOPICS
Create PDFs , JavaScript , PDF forms

Views

754

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 24, 2022 Apr 24, 2022

Flattening the fields will remove all code associated with them, and doc-level code can be removed using the removeScript method.

Votes

Translate

Translate
Community Expert ,
Apr 24, 2022 Apr 24, 2022

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 24, 2022 Apr 24, 2022

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,

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 24, 2022 Apr 24, 2022

Copy link to clipboard

Copied

LATEST

Flattening the fields will remove all code associated with them, and doc-level code can be removed using the removeScript method.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines