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

Print pages to PDF

Explorer ,
Jun 27, 2024 Jun 27, 2024

Copy link to clipboard

Copied

I have a pdf document with 30 pages.  I would like to print pages 2 and 3 to the Adobe PDF printer using javascript.  I tried the following javascript code in a button on page 2 but it does not work:

 

var pp = this.getPrintParams();
pp.printerName = "Adobe PDF";
pp.pageHandling = pp.constants.handling.fit;
this.print(pp);
pp.this.print(false, this.pageNum,(this.pageNum+1));

 

I would like the two pages to print without bringing up the print menu box.  Any help would be appreciated.  Thanks.

TOPICS
JavaScript , PDF

Views

205

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 2 Correct answers

Community Expert , Jun 27, 2024 Jun 27, 2024

Not possible. Instead, you should use the extractPages method. That will allow you to specify the path of the new file.

Votes

Translate

Translate
Community Expert , Jun 27, 2024 Jun 27, 2024

You can print to postscript, then open the postscript file in Acrobat to convert it to PDF.  This will flatten the PDF. 

See this entry in the Acrobat JavaScript Reference:

https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/JS_API_AcroJS.html#id799

 

Also, if the PrintParams object is used, then all printing parameters must be set in the PrintParams object.  The PrintParams object cannot be mixed with other print function inputs. 

 

Votes

Translate

Translate
Community Expert ,
Jun 27, 2024 Jun 27, 2024

Copy link to clipboard

Copied

Not possible. Instead, you should use the extractPages method. That will allow you to specify the path of the new file.

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 27, 2024 Jun 27, 2024

Copy link to clipboard

Copied

LATEST

You can print to postscript, then open the postscript file in Acrobat to convert it to PDF.  This will flatten the PDF. 

See this entry in the Acrobat JavaScript Reference:

https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/JS_API_AcroJS.html#id799

 

Also, if the PrintParams object is used, then all printing parameters must be set in the PrintParams object.  The PrintParams object cannot be mixed with other print function inputs. 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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