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

printing pdf from browser via javascript

New Here ,
Nov 11, 2016 Nov 11, 2016

I have a product that opens up html documents in a new tab on the browser and then sends a simple javascript command to print the document.

We are looking to move away from this approach, and would like to generate pdf's that then automatically print out.

So this question is simply part of a scoping exercise, and apologies if I am asking in the wrong place. 

So,

1) Is it possible to embed some basic Javascript into a pdf template that we have automatically filled in, so that when the document is displayed in a browser, it automatically sends the print command to the browser?

And if so

2) Is it possible for us to attach (merge?) 2 or 3 product sheets to this generated template, so that with one print command I can print out the completed template and any required product sheets rather than having to open X tabs, one for the template and one for each product sheet that is required.

Thanks

TOPICS
Acrobat SDK and JavaScript , Windows
1.4K
Translate
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 ,
Nov 11, 2016 Nov 11, 2016

1) You can embed a simple script in your PDF file that tells the application that opens it to send it to the printer, yes. Whether or not it will work depends on the application or plugin used to open the PDF. The code to use is simply:

this.print();

2) If you can control how the PDF file is built then you can merge the documents on your end, embed the code I provided above in the merged file and then send it to the user, sure.

Translate
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
New Here ,
Nov 11, 2016 Nov 11, 2016

Thanks. I will be able to control how the file is built, however the data sheets themselves are provided by 3rd parties. Is it possible to append existing files from various sources to the one I have created? (Ideally I want to print out my populated template, and then each datasheet without it recalculating any page numbers and so on)

I assume that I would need a full version of Acrobat to do all this? (Need to be sure on the version / code I have to buy as the templates will be automatically populated via data from a web form), so this whole process will be automatic and (hopefully) seamless!

Translate
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 ,
Nov 11, 2016 Nov 11, 2016

No, you can't do it with Acrobat. It's not a server-side application. You would need to find some other solution to merging the file on your end.

Translate
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
New Here ,
Nov 11, 2016 Nov 11, 2016
LATEST

Hmm ok. Well at least its part way there if I can get away from printing html and on to creating and filling in pdf's themselves.

Sounds like it is possible anyway, I just need to hit google some more. Thanks

Translate
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