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

Silent print to pdf using button action javascript

New Here ,
Jun 03, 2021 Jun 03, 2021

Copy link to clipboard

Copied

I have a button in a pdf form that has an on focus action to run a javascript. I need to print to pdf(or just save) without print dialog, or save dialog. I want to specify the name in the script using a variable:

var name="test";
var file_path="C:/Users/user/Desktop/Forms/"+name+".pdf";

 and after pressing the button, the test.pdf should appear in the specified path without any dialog window.

 

I tried:

var name="test";
var file_path="C:/Users/user/Desktop/Forms/"+name+".pdf";
var printer = this.getPrintParams();
printer.fileName = "";
printer.printerName = "Adobe PDF";
this.print(pp);
app.openDoc({cPath:file_path, bUseConv:true}; 
this.saveAs(this.path);

Nothing happens and the test.pdf isn't in the path.

TOPICS
Edit and convert PDFs , General troubleshooting , JavaScript , PDF forms

Views

2.3K

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 ,
Jun 03, 2021 Jun 03, 2021

Copy link to clipboard

Copied

You won't be able to achieve your goal from a button. Non-interactive printing can only be executed during batch, console, and menu events.

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 ,
Jun 03, 2021 Jun 03, 2021

Copy link to clipboard

Copied

LATEST

(And even then it's not entirely silent. The user is asked to approve it the first time it happens in each session)

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