[JAVA2D] Printing Resolution

2006-05-25 Thread java2d
How do I take advantage of the full resolution of the printer?  When I do a 
default print using the printer service I seem to get the resolution of the 
window that I am printing, is there some way of getting the resolution of the 
printer not that of the display device?  I have a Java2D graphics window, and 
have tried the following with no success:

   Graphics2D graphics2D = (Graphics2D) graphics;

   // Scale the printout to fit the pages.
  double scalex = format.getImageableWidth() / getWidth();
   double scaley = format.getImageableHeight() / getHeight();
   double scale = Math.min(scalex, scaley);
   // translate to the printable (0,0) location on the paper.
   graphics2D.translate((int) format.getImageableX(),
   (int) format.getImageableY());
   graphics2D.scale(scale, scale);
   // then paint the graphics 2D object.


I still get jagged lines on the printer device.  The original window maybe 
displayed at 600x600.
[Message sent by forum member 'diverdad' (diverdad)]

http://forums.java.net/jive/thread.jspa?messageID=116274

===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message signoff JAVA2D-INTEREST.  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message help.


Re: [JAVA2D] Printing Resolution

2006-05-25 Thread Phil Race

I suspect you are printing a double-buffered swing component window
using paint().
That paints to the swing back buffer which is unsurprisingly at screen
resolution
and then that is what you are sending to the printer.

Use Component.printAll() to print a Component, *not* Component.paint().

-phil.

[EMAIL PROTECTED] wrote:


How do I take advantage of the full resolution of the printer?  When I do a 
default print using the printer service I seem to get the resolution of the 
window that I am printing, is there some way of getting the resolution of the 
printer not that of the display device?  I have a Java2D graphics window, and 
have tried the following with no success:

  Graphics2D graphics2D = (Graphics2D) graphics;

  // Scale the printout to fit the pages.
 double scalex = format.getImageableWidth() / getWidth();
  double scaley = format.getImageableHeight() / getHeight();
  double scale = Math.min(scalex, scaley);
  // translate to the printable (0,0) location on the paper.
  graphics2D.translate((int) format.getImageableX(),
  (int) format.getImageableY());
  graphics2D.scale(scale, scale);
  // then paint the graphics 2D object.


I still get jagged lines on the printer device.  The original window maybe 
displayed at 600x600.
[Message sent by forum member 'diverdad' (diverdad)]

http://forums.java.net/jive/thread.jspa?messageID=116274

===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message signoff JAVA2D-INTEREST.  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message help.




===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message signoff JAVA2D-INTEREST.  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message help.


[JAVA2D] Printing resolution

2000-07-26 Thread Jerry Huxtable

All this talk of PageAttributes and printing has reminded me of a
strange problem I have here. I'm using JDK1.3 under Windows 98 and
printing to an Epson Stylus printer. If I print a load of vector
stuff, lines circles etc. then everything gets printed at printer
resolution and is fine. If, however I print a background image, the
resolution of all the vectors goes down to what likes like about 100
dpi, but may be 72dpi. How can I avoid this?

Jerry
Jerry Huxtable
http://www.jhlabs.com

===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".