Avg. Rating 4.5

Problem

I'm trying to add script to a button in an interactive PDF that will print a page range but the scripts I've found only open a print dialog box that still requires the user to specify the page range. I found this script below on the Adobe site, but it doesn't work, the document prints all pages. this.print({ bUI: false, bSilent: true, bShrinkToFit: true, nStart: 1, nEnd: 10 }); Help? Thanks!

Solution

If your document have 10 pages, to print from page 2 to 5 use the command as this.print({ bUI: false, bSilent: true, bShrinkToFit: true, nStart: 1, nEnd: 4 })

Detailed explanation

Hi,

You need to experiment and to figure out why its printing all pages from your document. Your script is this.print({ bUI: false, bSilent: true, bShrinkToFit: true, nStart: 1, nEnd: 10 });

If your document have 10 pages, to print from page 2 to 5 use the command as this.print({ bUI: false, bSilent: true, bShrinkToFit: true, nStart: 1, nEnd: 4 })

If you are not using nStart parameter, the bUI should be "true". When you put bUI as false, you may get a permission message similar to  "This document is trying to send info to the printer. Allow: Yes or No" .  The rule to print specific pages is simple,  they are based on 0. so nStart: 1, nEnd: 4 will print pages 2 to 5.

To print only the first page, use the code like this.print({ bUI: false, bSilent: true, bShrinkToFit: true, nStart: 0, nEnd: 1 })

To print only a single page for example page 5,  the code will be like 

this.print({ bUI: false, bSilent: true, bShrinkToFit: true, nStart: 4, nEnd: 4 })

To experiment, create a test document with three or four pages. By this way, you can save paper and time. 8-)

Hope it helps.


+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes