Expand my Community achievements bar.

Printing Error

Avatar

Level 3

Hi,

I have a pdf and I want tp print some specific pages from it. So, I am using the xfa.host.print() script in the click event of a "Print" button created by me. The script works fine except for this pop up message: "This document is trying to print. Do you want to allow this?". But this error message is also acceptable. But the main problem arises when I click "NO" on the pop - up message. After that if I try clicking the print button to print some page, script does not execute at all. Can you please let me know if this is the normal behaviour or am I missing anything?

2 Replies

Avatar

Level 10

Try passing true (or) 1 for the first argument for the xfa.host.print method to avoid this.. Then it opens the Printer selection screen..

xfa.host.print(true, "0", "0", 0, 1, 0, 0, 0); (or)

xfa.host.print(1, "0", "0", 0, 1, 0, 0, 0);

Replace the 2nd argument with the starting page number and 3rd argument with the ending page number you wanted to print.

Page values are 0-based, so you represent page 1 with a value of 0.

Thanks

Srini

Avatar

Level 3

Thanks for the response Srini.

The problem that I have is that I need to print multiple pages that are not in sequence. e.g. I may have to print pages 1-3 and 5-7 etc. and I have a total of 96 pages. So, to print them, I am using multiple xfa.print.host() and populating the page numbers dymaically. So, if in case I set the 1st option to 1/true, mutliple consoles come up for each xfa.host.print(). To avoid that I had set it to 0. When I set it to 0, it prints well and the specified pages. The only problem, as I mentioned earlier, is when I click "NO" in the pop up box that appears.