Printing, modification of the printable area (MediaPrintableArea?)

I try to print at one resolution other than 72 dpi, I managed this using the PrinterResolution (see code below), but I'm having a problem with the printable area. When I change the resolution to 300 DPI I just print tiny (that is to say the getImageableWidth(), etc. are always the same for 72 dpi) I was wondering how I can solve this problem, I tried to use MediaPrintableArea, but I don't want to limit my A4 user (IE I would actually have to code the dimensions in mm) is it possible that I can get the the pageFormat MediaPrintableArea?

This is my code:
     PrinterJob printerJob;
     PageFormat pageFormat;
     int numberOfPages;
     private String units;

        public void printAllGraphs(){
          numberOfPages=this.dataList.size();
          System.out.println("Number of pages : " + numberOfPages);
          
          printerJob = PrinterJob.getPrinterJob();
          printerJob.setJobName(" Print Component ");
          printerJob.setPageable(this);
          
          int newResolution = 300; int oldResolution = 72;
          
          PrinterResolution pr = new PrinterResolution(newResolution,newResolution,PrinterResolution.DPI);
          
          PrintRequestAttributeSet p = new HashPrintRequestAttributeSet();
          
          setPageFormat();
          
          if (printerJob.printDialog() == false)
               return;
          try {
               p.add(pr);
               p.add(mpa);
               printerJob.print(p);
          } catch (PrinterException ex) {
               System.err.println(ex.getMessage());
          }
     }
     
     public void setPageFormat()
     {
          pageFormat = printerJob.pageDialog(printerJob.defaultPage());// = pj.pageDialog(pj.defaultPage());
     }

        public int print(Graphics g, PageFormat format, int pagenum) {
          // Tell the PrinterJob if the page number is not a legal one.
          if ((pagenum < 0) | (pagenum >= numberOfPages)) 
               return NO_SUCH_PAGE;
          
          //work out the size of the page
          int width = (int)(format.getImageableWidth());
          int height = (int)(format.getImageableWidth());
          int x = (int)format.getImageableX();
          int y = (int)format.getImageableY();
          
          // Clear the background to white
          g.setColor(Color.white);
          g.fillRect(x,y,width, height);
          
          BufferedImage image = chart.chart.createBufferedImage(width, height);          
          g.drawImage(image, x, y,width,height, null);
          
          // Tell the PrinterJob that we successfully printed the page.
          return PAGE_EXISTS;
     }
Thank you

PS, I'm not sure if this should be in the forum of the swing or not :/

I'm sure that what I said is correct. If you open the Preferences of your printer dialog box, should be some button resolution of the printer of all the options. It will probably be by default set to 300 x 300 or 600 x 600 and can probably go up to 1200 x 1200 or maybe more. Most likely, it is not an option for 72 x 72 dpi.

That's what you change with the PrinterResolution attribute in java. DPI in this context doesn't mean "pixels per inch". Instead, it means how much ink, want you your printer to use and effects directly the quality.

If you would like your impressions of the image to look better, then use more ink by increasing the printer resolution. If you want to change the size of what is printed, and then apply an AffineTransform (or in your case, generate the graph to a smaller width/height).

Tags: Java

Similar Questions

  • DeskJet 2050 All - in - One J510a: outside the printable area

    Hi all

    I use-

    W.7, Ultimate, 64-bit.

    Name of the model: Deskjet 2050 All - in - One J510a
    Firmware version:... SLM2FN1006BR
    Serial number:... CN0BD3F28805D1
    Service ID:... 21074
    IK No.:... 670
    Software version:... 028.000.1313.000
    The printer driver version:... 09.84.00.1189

    When you use Word, in Office 2010, I have margins set to 'Normal ' -.

    Top: 0.98 "low: 0"

    Left: 0.12 "right: 1.18"

    Whenever I have insert a border around my text and that you try to print, I was informed that section 1 page borders are defined"beyond the printable area of the page. Do you want to continue? »

    By clicking on 'Help' I read and follow all the different "solutions" available. None allow the page to print.

    I selected all of the selections of available margin different and even selected some of my own under the "custom margins. The page to print with border permits.

    For example, one that I tried was-

    Top: 0.06 "low: 0.57"

    Left: 0.12 "right: 0.13"

    I then clicked on 'Options' under 'Page borders.'

    to the "measure of" I chose "Text" once more, I was unable to print the page with the border!

    I find this very frustrating, and I can't find a solution.

    I would be very grateful if there is a known workaround that will allow me to print a Word document with a border selected.

    (I have no technical experience, and if there is a soluition, I'd be happy to get detailed instructions!)

    Thank you

    ColinX

    Hello

    Your printer can print without margins (IE margin = 0 ").  This printer can print only to a certain margin.

    bottom margin is 0.57 ",
    top margin is 0.06 "
    and the left and right margins are 0.125 ".

    So if you try to print beyond this margin, the impression will be cut or outside the printable area.

    Kind regards.

  • OfficeJet 6500 E710n-z: How can I change the printable area

    I use a printer OfficeJet 6500 E710n-z.  In the past, with Microsoft Office 2007 and Publisher 2002 on a Windows Vista operating system, I was able to print publications with a margin of page of 0.125 "around all sides.

    I recently bought a new laptop running Windows 8.1 (64-bit) and upgraded to Microsoft Office & Publisher 2013.  Now my printable area is (landscape)-left margin: 0,587 "for a total width of 9,827".  The top margin remains the same, to 0.125 "for a total height of 8.25".

    I don't think I made any changes to the printer settings.  How to restore the printable region so that it has a margin of 0.125 "around the page?

    Hello @RonJRu,

    Thank you for visiting the Forums from the HP Support! " I see that you want to change your margins toward 0,125", since you upgraded to 8.1 of Windows and Microsoft Office & 2013 the printable region Editor is (landscape) - left margin: 0,587 "for a total width of 9.827 and the top margin is correct.

    When you upgraded to Windows 8.1, you would update the software and drivers for the printer as well?

    I would like to first run you printing HP scanner doctor > www.hp.com/go/tools

    -It has been designed by HP users troubleshooting and problems characteristic needed to solve many common problems encountered with HP print and scan products related to Windows computers.

    Let me know what the PSDR find, I'll watch for your reply.

  • Printer no longer works correctly. When I try to print nothing happens, the documents are waiting but the printer is offline.

    I reinstalled the printer three times. It works fine when I first install it, and then when I try to use it later it will not be printed. I ran the resolution of problems and there was a problem it could not fix. The last time that I used it, I was trying to print, nothing happened. About an hour or two later the printer came herself and documents printed on its own. I was not even at the computer. I had the printer installed more than a year without any problems. This just started happening. The only thing I can think who might have caused it comes from our modem died and we had to replace recently.

    I have a Toshiba Satellite L305-S5957 computer laptop, Windows 7, 32-bit and the printer is a MFC-495CW brothers. Any advice would be appreciated. Thank you.

    Hello

    Please contact the Microsoft community. We will be happy to help you with your concern.

    According to the description, you are facing problems with the printer.

    Please follow the steps to solve the problem with the printer. If the problem is still not resolved, please uninstall and reinstall the printer.

    Method 1: Please follow the steps in the link:

    Printer in Windows problems

    http://Windows.Microsoft.com/en-us/Windows/help/printer-problems-in-Windows

    Method 2: Remove and re - add the printer

    Install a printer

    http://Windows.Microsoft.com/en-us/Windows7/install-a-printer

    Let us know if you have other questions about Windows in the future. We will be happy to help you. We at Microsoft, strive for excellence and provide our customers with the best support.

  • HP Deskjet 6988 seems dead. Mid-page printing order, all the lights are off except the power cord light

    He won't return.  Push buttons does not help, or not pulling on the power cord to the printer, standby, restart the router & printers.  I have also connected by ethernet cable but I do not think that the connection is the problem because the printer is connected to power but will not produce lights or sounds.  It does not appear on the list of printers, and utility HP cannot detect it.   Windows Vista 32-bit, in my opinion, bought in 2007.  Is it gone forever?

    Hi Poboy,

    If the adapter has a green light to this topic, and you tried to plug it into different outlets, this would indicate that the printer may be dead. If you have tried these steps consult the following site

    http://www.HP.com/United-States/tradein/home_flash.html

  • My C309g takes 5 inks can I print grey if the colors are empty?

    I need to do some basic printing and do not need inks from color right now. My all in a 5 normal cartridges 4 and a separate black ink for printing. I'm wondering if I should replace all cartridges, the cost is a factor, or could just replace the black print quality and be able to print the text?

    Hello

    You must have one of the available 5 ink cartridges with ink available for printing, which is also required to maintain ink system and therefore cannot be circumvented.

    Kind regards

    Shlomi

  • How can I change the printable area in the 1510?

    I changed the margins in my Word document (T: 3; B. 3: R and l:. 5), but the it does not recognize and cut the first two lines.  How can I change the margins of the printer?  I have Windows 7.

    larrybmovie,

    Follow the steps below:

    1. go to your devices and printers

    2. click on your DJ 1510

    3. along the top where is add it an option of the device, select the print server properties

    4. under the Forms tab, select the option create a new form

    5. here, you can adjust the margins of the printer

  • Print to view the signatures are valid

    Hi all

    Can someone tell me how I can print a hard copy or soft copy to show that a PDF form a valid signatures?  When I print the PDF form, it shows that the signatures were signed digitally, but not where you can on the impression that the signatures were validated.  The only way I can think of is to do a screenshot with the signature panel showing that the signatures were valid.

    Thank you

    Johnny

    Hi Johnny,.

    The only way that Acrobat or Reader can vouch for the integrity of the digital signature is the application. Once you print it out file that acrobat/Reader has no way of checking that the printed document is cryptographically sound (which is what proves a digital signature). As such, specifically inhibit us the status of the signature of printing.

    Another way to think about it, it is the validity of an electronic document cannot be guaranteed in the electronic environment. Once the document moves in the physical world Acrobat (or any application that processes digital signatures) has lost control.

    Steve

  • the Air iPad does not connect to a printer to air even if the two are on the same network

    DIIAP Air does not connect to air printer, even if the two are connected to the same network. Message "Air printer not found".

    Readhere: printing from your iPhone, iPad or iPod touch - Apple Support

  • All-in-one Photosmart HP 7510: Photosmart 7510 - black ink cartridge print does not, but the tests are very well

    All the test prints are very good.  I have cleaned the print heads, broken cartridges.  I just replaced all the yesterday.

    Today, I can't print black.  The documents are great dimmed or blank pages come out.  I use a MacBook 2007, 10.6.8.  What else do you need to know?

    Thanks in advance!

    Hey @jas493,

    Welcome to the Forum from HP Support.  I hope you enjoy your experience here.

    I see you have a recurring problem of print quality with your HP Photosmart 7510 e-all-in-one printer.  I want to help you with this.

    What you describe, it seems that you tried all HP recommended troubleshooting steps.  Fortunately, given that your printer has a removable printhead, there are some other steps you can take to address the issue:

  • HP Photosmart D5460 printing problem using the cd/dvd tray

    Just bought a HP Photosmart D5460 solely for printing cd/dvd directly on cd/dvd labels.

    The problem I have prints a label on a Verbatim CD Vinyl.

    It is a normal 80 min CD - r but with an edge of vinyl and a 70mm print Center.

    When put in a fake cd (12mm diameter) cardboard, printing is excellent, exactly as it should.

    But as soon as I put in a CD of vinyl, the label is printed below the disc on the disc tray - holder, approx. 80mm below the mark where it should be.

    It drives me crazy, that everyone has seen this error before?

    Calibration is not help me... Also used almost every label possible software out there (Surething, Acoustica, Nero and Photoshop plain) who all give me the same result.

    Yes, I think that's the problem.

    I cut out a circle of plain white paper, which is the size of a cd and cut out the Center (a little more fat then 70mm of the printable area of the disc). Put on vinyl with tape adhesive tape and now it prints exactly on the label, to make it work.

    The black color of the disc must be the problem.

  • print HP deskjet d 1560 area questions

    Hello

    I would like to know what is the minimum distance from the bottom edge of the page that the HP Deskjet D1560 can proceed with printing in a MS Word Document.

    I checked with the HP Deskjet D1560 printer in the troubleshooting section manual; However it does not seem to be information specifically related to the printing area (!), unless she was spotted upward under a different title.

    The problem I have is that the foot of page edited in Word - default - format affects 1.29 cm, minimum bottom margin so that to be able to print the entire footer, I would need to display text in the footer above the 1.29 cm margin. While trying to set a value less than the less than 1.29 cm margin, the following message appears: "one or more margins are set beyond the printable area of the page. Choose the fix button to increase the appropriate margins ". After clicking the Fix button, automatically sets the bottom margin back to 1.29 cm, which gives to think that this is the minimum distance that the printer can actually start to print the lower edge, given of course adjustment under File/Page/Layout/from edge layout: 0 mm (if this value is increased, the bottom margin will increase accordingly).

    Is this the case? Your comments/suggestions will be much appreciated.

    Additional information: Windows Vista/32-bit, no windows, no change error message.

    Kind regards

    M4R3KHP

    Hi M4R3KHP,

    The print margins specification appears on the specifications below:

    http://support.HP.com/us-en/document/c01371151

    As I can see, the low minimum margin is 0.50 mm (1.27 cm) your properties desired simply unresponsive so the features of the product.

    Hope that clarifies your question, well

    Shlomi

  • I replaced my printer, but in the meantime an automated program sends print jobs to the old printer, I need reasign these jobs to print on the printer. __

    I want reasign the print jobs to the printer and print documents because the documents are no longer available due to the automated process.

    Hello Fishinmad02,

    Thank you for your message.  Check-post of the thread located HEREDaniel.

    Is it possible to move or copy a print job to a different printer?  My problem is I printer a few documents on the web to a printer that has been disconnected (not plugged into my USB port).  Is it possible to move or copy print jobs to another printer that I have on my system?

    I have not found a way to do it directly.  However, I found a work around that worked for me in my situation.  I went to the print queue, go to the tab printer, then properties, then the Ports... I've temporarily changed the port to point to the IP address of another printer (by changing the checkbox).  After printing the queue, I just put the IP and port back.  My two printers were of the same type, so I don't know if it would work with different printers.
    Daniel
    Please let us know if it did or did not help to solve your problem.
    See you soon

    Engineer Jason Microsoft Support answers visit our Microsoft answers feedback Forum and let us know what you think.

  • We installed HP60XL cartridges in our Photoshop D110 printer and make the message "Print cartridg.

    you are missing or not detected. The problem is that we do not seem to remove them either. They're stuck. Any suggestions?

    scantine wrote:

    He said that lie in the right slots.

    Here is a link to a statement emptyo and information on the installation of the cartridges.

    Ask husband to watch. He might see something that jogging his memory. (he forgot to remove the tape Strip?) This would make certainly difficult to remove and would disable the contact with the firmware of the printer.

    The cartridges are normally quite simple to remove and install. The only other thing I can suggest is to take in a PC shop or to have someone who is well informed to take a peek.

    Best regards

    ERICO

  • my printer print printing one above the other two work how do I get this to stop

    my daughter copied then pasted then printed a confersation Facebook it printed without problem but now everytime I try to print something again that which my daughter printed is being printed under also, I don't think it's that the print printer requests I directly from my printer are very well

    Hello

    . What is the brand and model of the printer?

    You must cancel all the print jobs for a printer, you must have permission to manage documents on the printer by following the steps below and let know us the status of the issue.

    a. open Printers by clicking the Start button, clicking Control Panel, hardware and soundand then click Printers.

    (b) to open the print queue, double-click the printer you are using.

    c. click on the printer menu, and then click Cancel all Documents. Function of the printer, the printing element could finish, but the remaining items will be cancelled.

     

    Note:

    . To quickly view which print jobs are underway, double-click the printer icon in the notification area.

    . To display the permissions of your printer, right click on the printer you use, click Properties, click the Security tab, and then click your user name. If your computer is on a domain, printer permissions can be controlled by your administrator.

    I hope this helps.

Maybe you are looking for