2 Replies Latest reply on May 7, 2008 11:45 AM by (darin_beaman)

    Print page range button not working

      We have been trying to add print functionality to a PDF.
      Specifically a button that will launch the print dialog box and print
      a specific page range.

      We are working in an existing PDF created with Acrobat 8
      We've created a button. Written a script for the button.

      We have attempted with several scripts and always have mixed results.

      Mostly the page range defaults to one page, instead of the range (1-3) sometimes it defaults to the entire document. Sometimes it works.

      We had one that worked consistently, then after we set the document properties, it stopped.

      Any clues?
        • 1. Re: Print page range button not working
          gkaiseril MVP & Adobe Community Professional
          What document properties did you change? Most will not affect JavaScript but some like the security setting to prevent modifying form fields will disable all buttons as well as all other form fields.

          You can create a JavaScript to print either using the "PrintParms" object or not using the object. I find not using the "PrintParms" object more reliable.

          The following code

          this.print({bUI: true,
          nStart: 0,
          nEnd: this.numPages - 1,
          bSilent: false,
          bShrinkToFit: false,
          bPrintAsImage: false,
          bReverse: false,
          bAnnotations: false
          });

          is the standard print command with the default settings to print the entire PDF. You will note that I have provided the parameter name and then the value. More information is in the JS API Reference.
          • 2. Re: Print page range button not working
            Level 1
            I changed the document properties for Navigation tab and Page layout. I don't think the property changes are affecting the javascripts on the button but the print range in the print dialog window gets selected differently each time clicking the print button, while the same pdf file was opened for the whole time.

            I tried JavaScripts to print both the "PrintParms" object or not using the object. I agree with you that not using the "PrintParms" object is more reliable, and found out that the page range works fine when bUI is turned off. It seems like the javascript get screwed when the print dialog box opens.

            I listed the code that I used for your reference.

            this.print({
            bUI: true,
            bSilent: true,
            bShrinkToFit: true,
            nStart: 0,
            nEnd: 1
            });