Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Print pages 1,3,11,15-16

Avatar

Level 2

I have a 17 page fillable pdf form, once completed i want pages, 1,3,11,15-16 to print as an image? i am new to scripting, how would i code this using a print button.  your help will be greatly appreciated. many THANKS

lynn

1 Accepted Solution

Avatar

Correct answer by
Level 7

Hiding the pages works, but I've found it just as easy to copy and paste the print script and change the to and from pages, as in:

xfa.host.print(0, "0", "0", 0, 0, 1, 0,0); - prints page 1

xfa.host.print(0, "2", "2", 0, 0, 1, 0,0); - prints page 3

xfa.host.print(0, "10", "10", 0, 0, 1, 0,0); - prints page 11

xfa.host.print(0, "14", "15", 0, 0, 1, 0,0); - prints pages 15 and 16

This script can go on the click event of the print button with javascript selected as the language. Either way will work, I'm just too lazy to use multiple events if I don't have to. 

If you haven't read the post that Niall references, I would still suggest you read it. It explains the print method script and explains how to open a print dialog box for the user. If you don't know ahead of time which pages the user will need to print, this would be a good option.

djaknow

View solution in original post

7 Replies

Avatar

Level 10

Hi,

You should check out Jono's response to this thread: http://forums.adobe.com/message/2397351#2397351

Also have a look at the print button which has the following javascript in the click event:

xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 1, 0, 0);

The sixth parameter relates to printing the page as an image. "1" = image; "0" = text. Have a look at the LC Designer help file.

Good luck,

Niall

Avatar

Correct answer by
Level 7

Hiding the pages works, but I've found it just as easy to copy and paste the print script and change the to and from pages, as in:

xfa.host.print(0, "0", "0", 0, 0, 1, 0,0); - prints page 1

xfa.host.print(0, "2", "2", 0, 0, 1, 0,0); - prints page 3

xfa.host.print(0, "10", "10", 0, 0, 1, 0,0); - prints page 11

xfa.host.print(0, "14", "15", 0, 0, 1, 0,0); - prints pages 15 and 16

This script can go on the click event of the print button with javascript selected as the language. Either way will work, I'm just too lazy to use multiple events if I don't have to. 

If you haven't read the post that Niall references, I would still suggest you read it. It explains the print method script and explains how to open a print dialog box for the user. If you don't know ahead of time which pages the user will need to print, this would be a good option.

djaknow

Avatar

Level 2

I added the script as you instructions indicated and it worked, if you don’t mind, can you help with one more thing? We are making efforts to go paperless and I really need to print these pages into an adobe pdf file. How would I code this into the print button? Thank you so much!

Lyndell Yazzie

lyazzie@nacog.org

P: 928-213-5238

F: 928-214-7235

119 E. Aspen Ave

Flagstaff, Az 86001

www.nacog.org

"Aging: If it's not your issue..it will be."

Avatar

Level 7

The only way I know of to print to Adobe PDF would be to have the user select the Adobe PDF printer from a print dialog box. The script I posted should print the form as an image, I don't believe the security built in to Adobe docs would allow you to select which printer is being used. You could write a startup script to set the default pc printer to the Adobe PDF printer for users within your company, but anyone on a pc you don't control would have to select it themselves.

Message was edited by: djaknow

Avatar

Level 2

I added a print button then added the script as you instructed, which prints directly to my printer and does not show me a print dialog box, to choose which printer to send to? Do I need to add another line of script to show the dialog box? thank you

Lyndell Yazzie

lyazzie@nacog.org

P: 928-213-5238

F: 928-214-7235

119 E. Aspen Ave

Flagstaff, Az 86001

www.nacog.org

"Aging: If it's not your issue..it will be."

Avatar

Level 7

The post that Niall put up earlier contains a link to a post that explains which parameter to change to force a dialog box to pop up for the user. Once you find it, you just need to alter the script I posted for you.

Avatar

Level 2

Thank you so much!

Lyndell Yazzie

lyazzie@nacog.org

P: 928-213-5238

F: 928-214-7235

119 E. Aspen Ave

Flagstaff, Az 86001

www.nacog.org

"Aging: If it's not your issue..it will be."