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

Similar Messages

  • Is it possible to print a JPanel from the application?

    Hello,
    Just a quick question: Is it possible to print a JPanel from your application? I have plotted a graph and I would like user to be able to print this with a click of a button (or similar)
    Thanks very much for your help, its appreciated as always.
    Harold Clements

    It is absolutely possible
    Check out my StandardPrint class. Basically all you need to do is
    (this is pseudocode. I don't remember the exact names of methods for all this stuff. Look it up if there's a problem)
    PrinterJob pd = PrinterJob.createNewJob();
    StandardPrint sp = new StandardPrint(yourComponent);
    pd.setPageable(sp);
    //if you want this
    //pd.pageDialog();
    pd.doPrint();You are welcome to have use and modify this class but please don't change the package or take credit for it as your own code.
    StandardPrint.java
    ===============
    package tjacobs.print;
    import java.awt.*;
    import java.awt.image.BufferedImage;
    import java.awt.print.*;
    import javax.print.PrintException;
    public class StandardPrint implements Printable, Pageable {
        Component c;
        SpecialPrint sp;
        PageFormat mFormat;
         boolean mScale = false;
         boolean mMaintainRatio = true;
        public StandardPrint(Component c) {
            this.c = c;
            if (c instanceof SpecialPrint) {
                sp = (SpecialPrint)c;
        public StandardPrint(SpecialPrint sp) {
            this.sp = sp;
         public boolean isPrintScaled () {
              return mScale;
         public void setPrintScaled(boolean b) {
              mScale = b;
         public boolean getMaintainsAspect() {
              return mMaintainRatio;
         public void setMaintainsAspect(boolean b) {
              mMaintainRatio = b;
        public void start() throws PrinterException {
            PrinterJob job = PrinterJob.getPrinterJob();
            if (mFormat == null) {
                mFormat = job.defaultPage();
            job.setPageable(this);
            if (job.printDialog()) {
                job.print();
        public void setPageFormat (PageFormat pf) {
            mFormat = pf;
        public void printStandardComponent (Pageable p) throws PrinterException {
            PrinterJob job = PrinterJob.getPrinterJob();
            job.setPageable(p);
            job.print();
        private Dimension getJobSize() {
            if (sp != null) {
                return sp.getPrintSize();
            else {
                return c.getSize();
        public static Image preview (int width, int height, Printable sp, PageFormat pf, int pageNo) {
            BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
            return preview (im, sp, pf, pageNo);
        public static Image preview (Image im, Printable sp, PageFormat pf, int pageNo) {
            Graphics2D g = (Graphics2D) im.getGraphics();
            int width = im.getWidth(null);
            int height = im.getHeight(null);
            g.setColor(Color.WHITE);
            g.fillRect(0, 0, width, height);
            double hratio = height / pf.getHeight();
            double wratio = width / pf.getWidth();
            //g.scale(hratio, wratio);
            try {
                   sp.print(g, pf, pageNo);
              catch(PrinterException pe) {
                   pe.printStackTrace();
            g.dispose();
            return im;
        public int print(Graphics gr, PageFormat format, int pageNo) {
            mFormat = format;
            if (pageNo > getNumberOfPages()) {
                return Printable.NO_SUCH_PAGE;
            Graphics2D g = (Graphics2D) gr;
              g.drawRect(0, 0, (int)format.getWidth(), (int)format.getHeight());
            g.translate((int)format.getImageableX(), (int)format.getImageableY());
            Dimension size = getJobSize();
              if (!isPrintScaled()) {
                 int horizontal = getNumHorizontalPages();
                 int vertical = getNumVerticalPages();
                 int horizontalOffset = (int) ((pageNo % horizontal) * format.getImageableWidth());
                 int verticalOffset = (int) ((pageNo / vertical) * format.getImageableHeight());
                 double ratio = getScreenRatio();
                 g.scale(1 / ratio, 1 / ratio);
                 g.translate(-horizontalOffset, -verticalOffset);
                 if (sp != null) {
                     sp.printerPaint(g);
                 else {
                     c.paint(g);
                 g.translate(horizontal, vertical);
                 g.scale(ratio, ratio);
              else {
                 double ratio = getScreenRatio();
                 g.scale(1 / ratio, 1 / ratio);
                   double xScale = 1.0;
                   double yScale = 1.0;
                   double wid;
                   double ht;
                   if (sp != null) {
                        wid = sp.getPrintSize().width;
                        ht = sp.getPrintSize().height;
                   else {
                        wid = c.getWidth();
                        ht = c.getHeight();
                   xScale = format.getImageableWidth() / wid;
                   yScale = format.getImageableHeight() / ht;
                   if (getMaintainsAspect()) {
                        xScale = yScale = Math.min(xScale, yScale);
                   g.scale(xScale, yScale);
                   if (sp != null) {
                        sp.printerPaint(g);
                   else {
                        c.paint(g);
                   g.scale(1 / xScale, 1 / yScale);
                   g.scale(ratio, ratio);
             g.translate((int)-format.getImageableX(), (int)-format.getImageableY());     
            return Printable.PAGE_EXISTS;
        public int getNumHorizontalPages() {
            Dimension size = getJobSize();
            int imWidth = (int)mFormat.getImageableWidth();
            int pWidth = 1 + (int)(size.width / getScreenRatio() / imWidth) - (imWidth == size.width ? 1 : 0);
            return pWidth;
        private double getScreenRatio () {
            double res = Toolkit.getDefaultToolkit().getScreenResolution();
            double ratio = res / 72.0;
            return ratio;
        public int getNumVerticalPages() {
            Dimension size = getJobSize();
            int imHeight = (int)mFormat.getImageableHeight();
            int pHeight = (int) (1 + (size.height / getScreenRatio() / imHeight)) - (imHeight == size.height ? 1 : 0);
            return pHeight;
        public int getNumberOfPages() {
              if (isPrintScaled()) return 1;
            return getNumHorizontalPages() * getNumVerticalPages();
        public Printable getPrintable(int i) {
            return this;
        public PageFormat getPageFormat(int page) {
            if (mFormat == null) {
                PrinterJob job = PrinterJob.getPrinterJob();
                mFormat = job.defaultPage();
            return mFormat;
    }

  • 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.

  • Is it possible to make master pages with several  title in one file? & Can I define page range from

    Is it possible to make master pages with several  title in one file? & Can I define page range from which page to which should be specific title?

    While the number of master pages is not unlimited, you can have quite a few in any file. I've never seen the limit documented, but it's in the hundreds, or more likely thousands. There is, I believe, a page limit of 9999 pages per document, but I don't know if that includes the masters or if they are counted separately.
    You can choose a page range in the Pages panel, then assign a master to them manually, and I beleive there are some scripts floating around that can assign a master page based on the appearance of a paragraph style (for chapter start pages, for example).

  • 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

  • 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

  • Printing Page Numbers - From To

    Please can you help me.
    I am exporting a Crystal Report to PDF per customer through vb code.
    I need to print a maximum number of pages (that will fit in an envelope e.g. 20) and then continue printing his data into a second PDF where it left off.
    Therefore I am trying to print out the crystal report in my VB.NET code by specifying a "Page From" and a "Page To".  How can I do this??
    For example I want to be able to say Print out pages 1 to 20
    Then print out 21 to 40 but the page count in the 2nd report should say (1 to 20)
    Thanks
    Ric

    Don,
    Thanks for your help.
    Your solution to resetting page counts in the report might be part of a solution...
    First of all - How can I reset the page counts within a formula?
    However my problem is a little more complex...
    In my VB code, I output the Crystal Report as a PDF file.
    However in the example I gave, where the customer has 30 pages, I need to generate 2 PDF files.
    The first PDF will be called CUSTXYZ_1.PDF (contains pages 1 to 20).
    The second PDF will be called CUSTXYZ_2.PDF (contains pages 21 to 30 but numbered as 1 to 10).
    I still need to find a way to output one report as 2 PDFs with pages 1 to 20 in the first pdf
    followed by 21 to 30 in the 2nd PDF.
    Maybe in my vb code i need to find a way to say:
    Print Pages 1 to 20 in one PDF
    Then Print Pages 21 to 40 in the second PDF
    I am not sure how I can do that...
    Any more ideas??
    Ric

  • Copying single page ,region from one application to another application

    Hi,
    I need information regarding How to copy single page or region from one application to another application in the same workspace

    Hi - have a look at this thread: -
    Synonyms
    Cheers,
    Mike

  • Can't Print to PDF from any application in Windows 8 with Acrobat V8

    Can anyone help me?  Adobe doesn't prvoide support for Acrobat 8 anymore.  I used to be able to print to Adobe PDF from other applications before I upgraded to Windows 8.  Now it never works, just gives me an error message that says "printer is in error state."  I am using Acrobat V8.0.0.  Thank you for any help you can give.

    Acrobat 8 is not compatible with Windows 8, so such errors are to be
    expected.

  • Can not print to PDF (From any application)

    I print to PDF's on a regular basis, and my mac has stopped me randomly from having that function.
    When I go to Print from any application, and select "Adobe PDF 7.0" from the Printer drop down an grey stop/error sign appears next to that drop down.
    Then the print queue appears with a red error and the item that i was printing gives a status of "-" and the comment of "Jobs Stopped"
    If I press the "Start Jobs" button I get a progress bar and the status changes to "Printing" ... the progress bar doesn't move and then the status returns to "-" and the item remains un-printed in the queue.
    Please help.
    Thanks.
    MacBook Pro 2.16 GHz Intel Core Duo   Mac OS X (10.4.8)  

    I managed to fix the problem by deleting the folder "com.adobe.print.AdobePDF7" from /Library/Preferences/
    And printed to a PDF

  • How to call/show  page(s) from different application

    Hi All,
    I'm working on couple of applications and some reports (about 30) are used in all applications. I need your advice on doing this efficiently.
    Is it possible to
    1) Create a separate application with all the reports.
    2) Create a blank page with lists linking to all those reports on the same tab
    Now, is it possible to call that page in a "reports" tab of each application without prompting for login and still have rest of the tabs visible while the user is using the reports?
    Thanks in advance,
    Asha
    Edited by: ashapatil on Jul 29, 2010 1:54 PM
    Edited by: ashapatil on Jul 29, 2010 5:41 PM

    Asha,
    you can create links to call pages from other applications without any problem, just take a look at the structure of APEX URL over here: http://www.oracle-and-apex.com/apex-url-format/
    To avoid re-logins you could either disable security on your application (not recommended) or create a custom authentication scheme which takes logged in users from other applications as granted.
    brgds,
    Peter
    Blog: http://www.oracle-and-apex.com
    ApexLib: http://apexlib.oracleapex.info
    Work: http://www.click-click.at
    Training: http://www.click-click.at/apex-4-0-workshops

  • 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

  • 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.

  • HP Officejet J4550 All-in-one printer Unable to print pages/photos from system request !

    I have an HP Officejet J4550 All-in-one printer that I had set p when I bought my new Acer system with Windows 7 installed and had no problem from the beginning to set-up the installation and have it running as My Default printer and has worked fine up until now ; when all of a sudden the system ;when I go to print a page/photo brings up the set-up - shows the printer as Default and then when I run PRINT...there is No page/photo printed out ? I have tried to run the Diagonistic software and shows the printer as Default and No problems and yet still delivers No Print out ? My system has had All up-dates automatically installed up till this point ...So I not being a Techie  ,do not know what or where to look for help to resolve the issue next ? Anyone able to tell me what to look for to do or how to resolve the issue or do I need to just Un-install the printer and Re-set it up again ?? I have tried to look at all places on HP ;but it does not even show my older HP Officejet -J4550 - All-in One Printer ? Just keeps referring to HP Officejet -4550 ?  Loooking for any answers ! Thank Yopu ,JS

    Hi jspin3,
    I'd like to help.  For now, I would hold off on the uninstall and reinstall.  Can you answer some questions?
    Is the printer connected by USB, Ethernet or wireless?
    Do you get any error messages?
    Does a blank page come out or do no pages come out when you try to print from the computer?
    If you put a document face down on the scanner glass, are you able to make a photocopy?
    Can you estimate the ink levels, in percent full for each cartridge, by looking at the printer ink gauge?  Click Here 
    If you print a  Self Test Report,  do all of the colors print?
    Also, remember a click on the Kudos star to the left is a quick "Thanks" for a helpful post.
    Please select the "Accept as Solution" button on the post that best answers your question.
    I appreciate your input ! ___________________________________ _____
    Thank You,
    Rich
    Expert

Maybe you are looking for