Print page ranges

With the print dialog that is displayed when you call:
PrinterJob job = PrinterJob.getPrinterJob();
PageFormat pf = job.pageDialog();you can only print continuouspage ranges (like x to y). We would like to print discontinuous page ranges (like "1;5-6;9").
Is there a built in way to achieve this?
Any help would be appreciated.

Hi Stas,
thanks for your reply.
I tried the following code.
import java.awt.*;
import java.awt.print.*;
import javax.print.attribute.*;
public class PrintDialogExample {
    public static void main(String args[]) {
        PrinterJob job = PrinterJob.getPrinterJob();
        job.setPageable(new Pageable() {
               public Printable getPrintable(int pageIndex)
                         throws IndexOutOfBoundsException {
                    return new Printable() {
                         public int print(Graphics g, PageFormat pageFormat, int pageIndex)
                                   throws PrinterException {
                            if (pageIndex > 9) {
                                return NO_SUCH_PAGE;
                            Graphics2D g2d = (Graphics2D)g;
                            g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
                            g.drawString("Test the print dialog!", 100, 100);
                            return PAGE_EXISTS;
               public PageFormat getPageFormat(int pageIndex)
                         throws IndexOutOfBoundsException {
                    return new PageFormat();
               public int getNumberOfPages() {
                    return 10;
        PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
        PageFormat pf = job.pageDialog(aset);
        boolean ok = job.printDialog(aset);
        if (ok) {
            try {
                 job.print(aset);
            } catch (PrinterException ex) {
}Hope thats what you meant?! Now there is a page dialog and a print dialog, but still no way to print discontinuous page ranges (like "1;5-6;9"). Any ideas?
Regards,
Wost

Similar Messages

  • Print page range set thro Javascript issue in Acrobat 8.0

    Hi,
    I coded to a bookmark as below in a PDF Using Adobe Acrobat.
    this.print({bUI:false, nStart:0, nEnd:1, bSilent: true});
    when i click the bookmark the print panel opens with all pages selected. The same working fine with Acrobat 9.0 and other readers. The problem persist only in Acrobat 8.0.
    Is it a bug in Acrobat 8.0?

    You mean, Edit>preferecnces (ctrl+k)
    Javascript--- Enable Acrobat Javascript (check box)
    Yes, it's enabled. When i click the bookmark, the Print dialog box opening, which means the Javascript is running. But Print page range is set to All, It suppose to be 1-2.

  • Printing page range in document with more than one page #1

    I have an insurance application which has 24 pages numbered 1-6 then restarting 1-18.  This is not just the page # at the bottom of the page but the page number that Adobe Free Reader is showing.  When on the last page the top of the screen shows [18] 24 of 24. 
    I want to print the first page 5 which works fine when I print current page or a page range.  Then I want to print 1-12 of the second section which I have tried printing as 7-18.  This gave me the pages numbered 7-18 of the second section.  But if I try printing page 1-12 I get 18 pages or 1-6 + 1-12.
    Any help would be appriciated.
    Thanks,
    Paul

    Change the Preference from using logical pages to physical pages and then select the physical pages.
    You should provide unique names for the page numbers when you apply page numbers to the PDF and you need to fix them if you merge PDFs.

  • Adobe X Printing page ranges in pdf's with multiple sections

    I'm trying to print a page range in a document that is divided into sections that start over with page 1 or page i, and using an absolute page range doesn't work.  For example, the document has an initial cover page up to the Contents page numbered i - vi, then the Contents section is numbered i - iv, then the Figures section is numbered 1 - 2, then the Chapter 1 section is numbered 1 - 6, Chapter 2 is 1 - 14, etc.
    In Adobe X, the default toolbar with the print, mail icons, then the up and down arrows, is followed by a box with the "page number" in it followed by a page range in (); for ex., the box has '1' in it and the range shows (15 of 94).  If I was viewing the title page, the box would have 'i' in it followed by (1 of 94), etc.
    When I try to print, the dialog menu shows the "Print Range" of "All", "Current Page", and "Pages".  If I select "Pages" and enter the absolute number from the range in () like (15 of 94), and I want to print absolute page 15-35, and I enter that in the "Pages" box as 15-35, what I get is a section further in the document that I don't want at all, and not the desired page range.  In fact, since the sections all restart the page numbering, I can't even find the starting page because the print function is totally confused about what page I mean.
    In previous Acrobat versions, I had no trouble using the absolute page range since that is obviously required to get the desired range; i.e., Acrobat can't know what section I want, so for ex. putting page 1-10 can mean any section with 10 pages.  I don't know how to use a page range for sections, like 2.1 - 2.4 or 2-1 to 2-4 because the Page range box doesn't recognize that.  And again, the absolute page ranges don't work either.
    The only way to print this document is to select the "All" button.  If the doc is 1000 pages long, I don't want to waste all that paper!!  Please help!

    You can use the thumbnails pane and print pages selected within the pane.
    Have you tried other strings like:
    1 - 6 , 1 - 13

  • Print page range

    Can anyone tell me how I can access the page range values set in the print dialog afetr displaying teh Print dialog to a user?????

    Thanks for your answer. I have 2 follow up questions on this then:
    1. What function do I call to put it into teh real Printer dialog.
    2. How do I disable the other Page Range attribute such as "All", "Select" in the real Print Dialog.

  • Printing page ranges from an application

    Hi,
    I am using the windows print command from inside an application to print pdf files and it works great.
    Now, is there a way to tell windows/reader to print only selected pages?
    Thanks.

    Moved to Acrobat SDK

  • Using Acrobat 9 and suddenly there is no selected page range in the print box.   Only selected PDF files or all PDF files.  Am I doing something wrong?  I need to print only three pages from the document

    There is no selected print page range in the print box.  Only selected PDF file and all PDF files.  Any suggestions?

    Well, I looked for where to delete this but didn't see it.
    NEVERMIND; I forced iPhoto to quit and restarted and everything seems fine.
    BTW, I did get one thing wrong. When I looked at both iPhoto libraries with FINDER, the active one and the archived one both showed content as far as file size goes.
    It was because I was viewing the files through Adobe Bridge that it was showing 0 GB's; for whatever reason.

  • How to print a page range in Word 2011

    Hello
    I would like to print only a certain rage of pages of a large Word 2011 document. However, when I enter "from page"  = 5 and "to page" = 7, my MacBook and my MacMini oth print always the whole document.
    I tried it on three diffrent printer (Canon, Lexmark and Xerox), but got always the same result.
    I read some articles that you have to enter the section, but neither in the field from page or to page I am able to enter letters like "s5" or "p5" and I don't have the ofion "page range in any of the printer driver.
    I also tried diffrent documents, new documents created on Mac, small documents with only two pages and large documents with 200 pages. Allways the same result, Word prints the whole document.
    I use the latest office for Mac version and also the latest OSX 10.8.3.
    How can I print only certain pages??
    Thanks for any help,
    Rolly

    Maybe this will help. If you monitor the "More Like This" box (top right), other threads appear. Opening them usually displays other threads.
    https://discussions.apple.com/message/20070939#20070939
    https://discussions.apple.com/message/16608360#16608360

  • Print multiple page ranges based on radio button group choices

    Hi ... I have a PDF that is a combined application form made up of 6 separate forms. On the front page, I have 6 groups of "Yes / No" radio buttons.
    If the radio button for one or more of these groups is selected as "Yes" then when the Print button (on the page) is clicked then the appropriate page ranges will print.
    It is desireable, though not essential, for these to be printed in one print job.
    The Code I have been adjusting to try and achieve the result is below but I have tied myself in knots now and any help would be greatly appreciated:
    Many thanks
    //<AcroForm>
    //<ACRO_source>PrntForms:Annot1:MouseUp:Action1</ACRO_source>
    //<ACRO_script>
    /*********** belongs to: AcroForm:PrntForms:Annot1:MouseUp:Action1 ***********/
    var nButton = app.alert({
    cMsg: "Your selected forms will be sent to your default printer.\n\nIf you require to print to an alternative printer, press cancel and select 'Print' from the 'File' menu.",
    cTitle: "Submit Forms for Printing?",
    nIcon: 1, nType: 1
    // array for button responses
    //var aResponse = new Array("OK", "Cancel");
    if(nButton == 1)
    {    this.print({ bUI: false, bSilent: true, bShrinkToFit: true, nStart: 1, nEnd: 1 });
    } else
    if(nButton == 0)
    {    this.Exit
    var a_app;
    if(this.getField("AppForm1”).value=="Yes"){
        a_app = "1, 1";
    } else a_app = "0, 0"
    var b_app;
    if(this.getField(“AppForm2”).value=="Yes"){
        b_app = "2, 2";
    } else b_app = "0, 0"
        var pp = this.getPrintParams();
              pp.interactive = pp.constants.interactionLevel.full;
              pp.printRange=[[a_app], [b_app]];
              this.print(pp);
    //</ACRO_script>
    //</AcroForm>

    Hi Gilad D
    The 'printRanges.push' function works well on my Mac using Adobe Acrobat Pro XI however when it is used on the systems that the form users will be working on (which runs Adobe Reader 9.4.0.195) the ranges are not pushed to the printer dialogue box and the 'printRange'
    in the dialogue is still selecting the 'All Pages' radio button.
    Is the printRanges.push function a new and non-backwards-compatible function or is my code the problem
    //<AcroForm>
    //<ACRO_source>PrntForms:Annot1:MouseUp:Action1</ACRO_source>
    //<ACRO_script>
    /*********** belongs to: AcroForm:PrntForms:Annot1:MouseUp:Action1 ***********/
    var printRanges = [];
    if (this.getField("RBG10").value=="Yes") printRanges.push([0,2]);
    if (this.getField("RBG1").value=="Yes") printRanges.push([3,18]);
    if (this.getField("RBG2").value=="Yes") printRanges.push([19,27]);
    if (this.getField("RBG3").value=="Yes") printRanges.push([28,38]);
    if (this.getField("RBG4").value=="Yes") printRanges.push([39,42]);
    if (this.getField("RBG5").value=="Yes") printRanges.push([43,54]);
    if (this.getField("RBG6").value=="Yes") printRanges.push([14,16]);
    if (this.getField("RBG7").value=="Yes") printRanges.push([55,56]);
    if (this.getField("RBG8").value=="Yes") printRanges.push([57,65]);
    if (this.getField("RBG9").value=="Yes") printRanges.push([66,71]);
    if(printRanges.length>0){
       var pp = this.getPrintParams();
                pp.interactive = pp.constants.interactionLevel.full;
                pp.printRange=printRanges;
                this.print(pp);
    }else app.alert("No page ranges are selected");
    //</ACRO_script>
    //</AcroForm>
    Any assistance is greatly appreciated.
    Many thanks

  • Print each page range double sided as new task

    Hi All,
    I have that problem. I would like to double sided print some pages from pdf file - let's say pages 1 to 5. But I want them to print like this - pages 1-2 on the first sheet of paper, page 3 on the second sheet (the other side of this sheet I want to be blank) and pages 4-5 on the third sheet.
    If I type page ranges 1-3,4-5 when printing the result will be the same if I would type page range 1-5, so pages 1-2 will print on first sheet, pages 3-4 on the second sheet and page 5 on the third sheet. That's not what I want.
    The only solution is to first print pages 1-3 and then open printing dialog box again and print pages 4-5 so they would be two separate tasks for printer. But this is very time consuming when working with large files.
    I do not have Adobe Acrobat to insert blank page after each section that is odd numbered so this is no solution for me.
    Could you please help? Any ideas how to work this out? Is there any printing set up to print each page range as separate task?
    Or maybe there is a way to double sided print odd numbered page ranges with an additional blank page at the end so that the next range would start on new sheet?
    Thank you in adavnce

    dear ,
    check ur printer settings , bcos u are using std.program , so i cannt say SAP is doing wrong , better to check ur printer settings
    Regards
    prabhu

  • OfficeJet 8600 doesn't print full page range from pdf with Mac OS X

    I have an OfficeJet Pro 8600 linked to a Mac with OS X Mavericks
    We often need to print a block of pages (say the first 40, or 10-20 out of the middle) out of large pdf documents of 250pg or more. To do so we put in the page range under 'pages' in the print instructions box.
    The printer sometimes prints an initial block of pages, then cuts off. If we then try to print the remaining pages, it starts by printing the whole range again, with the ones we already have, and then still cuts off maybe after having done 2-3 more than the first time round. To print the whole range we've eventually had to print the last pages one at a time.
    Any suggestions as to why this is happening, and how we can stop it? It happens with documents in Adobe Reader and web pages.
    Thanks for any assistance.

    Hi @NickRN8 
    I am not sure what is causing the inconsistency in selected pages not printing, but I'd be happy to help.
    Let's reset the printing system, repair disk permissions, re-add the printer using the right driver, and try to scan again.
    Reset Printing System
    Click the Apple icon (   ), and then click System Preferences.
    In the Hardware section, click Print & Fax/Scan. The Print & Fax/Scan  dialog box opens.
    Right-click (or  Ctrl  +click) in the left panel, and then click Reset printing system…
    Click OK to confirm the reset.
    Type the correct Name and Password.
    Click OK to reset the printing system. The Print & Fax dialog box shows no printer selected
    Note: This will remove all printers in the print and Fax/Scan, any printer removed can be re-added later by clicking the plus (+) symbol.
    Repair Disk Permissions
    On the Dock, click Applications, and then click Utilities.
    Double-click Disk Utility.
    Highlight your hard drive/partition on the left (by default this is "Macintosh HD").
    Click the Repair Disk Permissions button at the bottom of the window.
    Once the repair is complete, restart the computer and add the printer back.
    When you add the printer, please ensure you are using the HP driver.
    Select Add other Printer or Scanner                                                      
    Select the printer you are adding and next to 'Use' you can select the printer driver 
    I look forward to hearing from you. If the issue remains unresolved, I will post instructions to completely scrub the HP software from the computer and start fresh.
    Please click the Thumbs up icon below to thank me for responding.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
    Sunshyn2005 - I work on behalf of HP

  • Cannot Print "current page" or "page range" in Compatibilty Mode in Word 2010

    We are upgrading to Word 2010 from Word XP
    All old documents open in Compatibility Mode
    None can print a page range or current page, the whole document prints instead
    I have tried to "Convert" to the 2010 format to no avail.
    This does not happen on Documents created in 2010.
    The only workaround I have found is to Copy the entire document into a New Word 2010 Document.
    Is there a fix for this? Is anyone else having the same problem?  It is not the same as the section problem I have seen all over these forums.
    Thanks
    Stuart Willis
    [email protected]

    Hi,
    I am writing to see how everything is going with this issue. Have you tried to update the printer driver? Is the problem resolved?
    For more research, this article may help us to continue to troubleshoot the issue
    http://support.microsoft.com/kb/918790
    Feel free to post back. Thanks.
    Tony Chen
    TechNet Community Support

  • Print different page ranges of a document without, each time, having a print dialog?

    Hello,
    Would need your valuable help on that one.
    I have a large PDF File, of which I want to print different page ranges, based on the checkboxes that have been checked by the User.
    Ideally, clicking a "print" button would generate the page ranges, based on the checkboxes that are checked and open one print dialog with the pages ranges already indicated in it. Like this, the User can enter once the printer settings (e.g. booklet or duplex) he wishes, which should then be valid for all the pages contained in all the page ranges.
    Thank you in advance for any tip!
    Cheers
    Serge

    PrintParams.constants.flagValues.duplexTypes.DontCare
    PrintParams.constants.flagValues.duplexTypes.Simplex
    PrintParams.constants.flagValues.duplexTypes.DuplexFlipLongEdge
    PrintParams.constants.flagValues.duplexTypes.DuplexFlipShortEdge

  • Trouble printing selected page range as handout

    I am trying to print for a keynote but only want a selected page range and just cannot seem to get it to work. When I go into print and select under the pages tab the "from" button and type the range ( eg 184-189 ) I only get the option of slides with notes or outline. I want to pront as a handout with 2 or 3 sldes per page. The preview shows no pages selectde and it is unable to print.
    I've tried highlighting the slides I wish to print and trying that but to no avail. The silly thing is I did manage to get it to work this way once but now it doesn't seem to work that way. I'm frustrated as I don't want to print the whole presentation off and throw away the sheets I don't need as it seems to defeat the object of page selection. I also don't want to watse ink by having one slide per page.
    Any help will be gratefully received.

    I have this issue with my printer also
    my work around is to delete the pages I dont want printed, save this version as a separate file and the pages I want print out correctly.

  • Javascript Code to Print Multiple Page Ranges in Acrobat

    Hi All,
    I am very new to Javascript (used it for the first time this morning) and was looking for some help.
    I have built a fillable pdf form in Acrobat that I am required to print on a very regular basis.
    However, when I print it, there are only particular pages that I need to print as opposed to the entire document.
    I have put in a Print button that executes the below code when pressed:
    this.print (true, 1, 25) ;
    this.print (true, 27, 28) ;
    This allows me to print two different page ranges, but it separates them into two different print jobs.
    Is there a code that will allow me to put them into the same print job, so that it selects pages 1-25, 27-28 rather than doing them separately?
    I am currently using Adobe Acrobat X Standard.
    Any input would be much appreciated.
    Thanks!

    Acrobat/Reader 11 allows you to use the printRange property of the PrintParams object that's used with the print statement: http://livedocs.adobe.com/acrobat_sdk/11/Acrobat11_HTMLHelp/JS_API_AcroJS.89.1013.html
    See the sample code included at the link above.

Maybe you are looking for

  • User Defined Function

    Hi, I have been currently working on a PL/SQL function which will accept a column name from the user and return the following output. Column1 func(‘column1’) 1 2 2 3 3 4 4 5 5 OUTPUT 1 Wherein Column1 is the column present in the table and func(â

  • I lost my itunes gift card

    I lost a new, unused itunes gift card.  I have the receipt from a big box store.  Is there anyway to still get its credit? thanks, gcolvin

  • Error Code: U44M1I210 - I ot this trying to update Photoshop CS6/CS6 extended - What's it?

    I got this Error code trying to update Photoshop CS6/CS6 extended - What's is it and is there a fix?

  • Compatability with sound systems

    I have a Grundig Ovation CD/tuner which has a USB port for playing MP3 files. My ipod isn't recognised by the system and therefore doesn't play. Anyone know why? Different file format?

  • Disapointed in iMovie 11 and iDVD

    I have done a lot of home movie work in the past on Windows with Sony Vegas - capture from MiniDV camera, edit, burn DVD and been very pleased with the results. I am just switching to Mac, and expected the results to be at least as good as they were