Expand my Community achievements bar.

SOLVED

Printing 4 of 6 pages twice

Avatar

Former Community Member

Is it possible to print to 4 or 6 pages of my form twice and the other 2 pages once, do I need to do this from an external PDF?

1 Accepted Solution

Avatar

Correct answer by
Level 7

This is actually much simpler than it might sound. You can use this script to print all the pages in a form:

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

To print them twice, simply insert the line twice, like this:

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

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

In order to print just the last 2 pages of a 6 page form, you would add this script:

xfa.host.print(0, "3", "5", 0, 0, 0, 0, 0);

Bear in mind that page values are zero based which is why you would use "3" to represent page 4 and "5" to represent page 6. So, to print all pages twice and the last two pages once, your entire print script would be:

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

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

xfa.host.print(0, "3", "5", 0, 0, 0, 0, 0);

You can find the print method that defines all the values in the print script in the help section under Scripting Methods > print.

Hope this helps,

Dave

View solution in original post

4 Replies

Avatar

Former Community Member

You can control the page numbers to print but I do not think you can control th enumber of copies to print. You may have to issue multiple print commands to accomplish what you want.

Paul

Avatar

Correct answer by
Level 7

This is actually much simpler than it might sound. You can use this script to print all the pages in a form:

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

To print them twice, simply insert the line twice, like this:

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

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

In order to print just the last 2 pages of a 6 page form, you would add this script:

xfa.host.print(0, "3", "5", 0, 0, 0, 0, 0);

Bear in mind that page values are zero based which is why you would use "3" to represent page 4 and "5" to represent page 6. So, to print all pages twice and the last two pages once, your entire print script would be:

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

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

xfa.host.print(0, "3", "5", 0, 0, 0, 0, 0);

You can find the print method that defines all the values in the print script in the help section under Scripting Methods > print.

Hope this helps,

Dave

Avatar

Level 4

You either use multiple print commands (has showed by the previous posters) or you create visible print only "copies" of the pages you want to print twice in your form. This does the trick but requeries a bit of work and will make your PDF bigger (disk size).

Avatar

Former Community Member

Thank you, after a few modifications I got it working as I want it to.