Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Print-Script: print as PDF and open document

Avatar

Level 1

Hey =)

I created some pdf forms where it is very important to preview the pre-print state frequently.

Since there is apparently no solution for a preview button I have another idea:

Is is possible to add a scripted print-button which prints the document as a pdf-file and opens it immedietly?

(It would propably be even better if the pdf-file would be saved to the %temp%-folder.)

I appreciate every help =)
Thanks in advance.

1 Accepted Solution

Avatar

Correct answer by
Level 3

I used this script and it worked:

  1. var pp = event.target.getPrintParams(); 
  2.     pp.printerName = "Adobe PDF"
  3. event.target.print(pp); 

View solution in original post

5 Replies

Avatar

Level 3

Did you ever figure this out? I have a similar question.

Avatar

Level 1

Sadly I found no way to preview a form in a convenient way.

Avatar

Correct answer by
Level 3

I used this script and it worked:

  1. var pp = event.target.getPrintParams(); 
  2.     pp.printerName = "Adobe PDF"
  3. event.target.print(pp); 

Avatar

Level 1

Nice I will give it a try. What exactly is this script doing?

Avatar

Level 3

When you click the button with that script, it opens a print dialog box with Adobe PDF selected as the printer.