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

Defualt printer name as Adobe PDF

Avatar

Level 3

Hi,

Need help in printing the Adobe LiveCycle PDF in Adobe PDF defualt.

We have requrement, when user clicks on print buttonm by default printer name should be as Adobe PDF and when user clicks on Ok it should print in PDF istead of hard copy.

Is is possible ?

Thank you,

Jay

1 Accepted Solution

Avatar

Correct answer by
Level 10

Ohh yes, I forgot to correct the script,

Replace "this" with "event.target".

var pp = event.target.getPrintParams();

pp.interactive = pp.constants.interactionLevel.automatic;

pp.printerName = "Adobe PDF";

event.target.print(pp);

View solution in original post

6 Replies

Avatar

Level 10

Hi,

you can do this with a custom print button in your form and a bit of JavaScript:

var pp = this.getPrintParams();

pp.interactive = pp.constants.interactionLevel.automatic;

pp.printerName = "Adobe PDF";

this.print(pp);

Note: This script has no effect on the applications print button or the print command ctrl + p.

Avatar

Level 3

Hi Thanks a lot for providing script.

I tried same script on the form and when i click on Custom button, in debugger message is showing as "this.getPrintParams is not a function"

Thank you for your support and help.

Regards,

Jay

Avatar

Correct answer by
Level 10

Ohh yes, I forgot to correct the script,

Replace "this" with "event.target".

var pp = event.target.getPrintParams();

pp.interactive = pp.constants.interactionLevel.automatic;

pp.printerName = "Adobe PDF";

event.target.print(pp);

Avatar

Level 3

Excellent!!! working as per requirement.

Thanks a lot for the help.

Regards,

Jay

Avatar

Level 3

Hi,

Is there any option or script to change the default PDF file name after generating PDF.

Thank you,

Jay

Avatar

Level 2

Hi Jay,

Did you end up finding a way to dynamically change the PDF file name?  I can change the .ps file name using:

pp.fileName = "/u/forms/purchase order/" + docName + ".ps";

However I get an error when I use:

pp.fileName = "/u/forms/purchase order/" + docName + ".pdf";

Thanks

Stefan