java printing issues

By: Bernd Proissl - berndproissl
java printing issues
2002-07-18 03:18
Hi,

I try to use jasper with a 200dpi label printer. Small fonts down to 7 ot 8 pt should be printed on the labels. MS Word is able to handle to size and the printing quality is as expected (for 200dpi).

With jasper the visual quality of this small (and even for normal sized fonts e.g. 8/10/12) fonts is relatively bad. You may compare it to a faxed document.

I guess the problem is with the java printing support which does the rendering itself and maybe not very good for a 200dpi device?

Some tests with the new Java Print Services API gave me the expected results. The output looks like the MS Word printing.

One of the issues I could not solve until now was how to
set the imageable area with this new Print Service API. Anybody has some advice?

Maybe anybody has ported JRPrinterAWT to the new API?

Teodor, do you plan support for this new API? This would restrict jasper to the newer JDKs.

Thanks
Bernd


By: Teodor Danciu - teodord
RE: java printing issues
2002-07-18 06:22

Hi,

For the moment I don't have too much experience
with the new printing API.
It would be great if someone who already worked
with it could provide us with a new version of the
JRPrinterAWT class.

I'll try it myself, if I'll have the chance.

Thank you,
Teodor



By: Bernd Proissl - berndproissl
RE: java printing issues
2002-07-18 22:00
I now have a working test outside JRPrinterAWT. Looks like it will not be too much work to enhance JRPrinterAWT.

I will let you know...

Bernd



By: Bernd Proissl - berndproissl
RE: java printing issues
2002-07-19 08:15
Hi,

I can get the expected quality when I do some hacking in JRPrinterAWT:

Nearly at the end of the file I replaced
layout.draw(grx, drawPosX + text.getX(), drawPosY + text.getY());
with
grx.setFont(new Font(text.getFont().getFontName(), Font.PLAIN, text.getFont().getSize()));
grx.drawString(paragr_text, drawPosX + text.getX(), drawPosY + text.getY());

I never worked with Fonts and Java2D, so this is really a hack.

Teodor, may I ask you to give me a comment?

Thanks,
Bernd







By: Teodor Danciu - teodord
RE: java printing issues
2002-07-19 08:39

Hi,

That line that you have replaced is the most
sensitive section of the whole library.
:))

This is a terrible hack.
:))

In fact this destroys all the text field stretch
mechanism. I wouldn't touch it.

Good luck!
Teodor



By: Bernd Proissl - berndproissl
RE: java printing issues
2002-07-23 05:50
Hi Teodor,

why is this distinction made in JRPrinterAWT in the call of setImagableArea?

case JasperReport.ORIENTATION_LANDSCAPE :
{
..
paper.setImageableArea(0, 0, jasperPrint.getPageHeight(), jasperPrint.getPageWidth());
...
}
case JasperReport.ORIENTATION_PORTRAIT :
default :
{
..
paper.setImageableArea(0, 0, jasperPrint.getPageWidth(), jasperPrint.getPageHeight());
}

The current version works for me in Portrait and Landscape for DIN A4 paper but it does not work for my label printer.

When I just call
paper.setImageableArea(0, 0, jasperPrint.getPageHeight(), jasperPrint.getPageWidth());

for both orientations, both the A4 and the labels print correctly.

The label size is 28x60mm. (Seiko Smart Label Printer 240)

Thanks, Bernd


By: Bernd Proissl - berndproissl
RE: java printing issues
2002-07-23 06:02
please ignore my last post. :(
Bernd



By: Bernd Proissl - berndproissl
RE: java printing issues
2002-07-23 23:42
The poor rendering quality also happens when I print to an Adobe acrobate PDF writer. The pdf looks ugly on the screen but prints perfectly.

Use of the above described hack also removes this problem.

Any ideas?


By: Bernd Proissl - berndproissl
RE:: java printing issues
2002-08-08 01:24
Hi,

this is from Sun
------------------------------------------------------------------
The bug report you submitted has been determined to
be a new bug. It has been entered into our internal
bug tracking system with the assigned Bug Id: 4727913.

The state of the bug can be monitored via The Java
Developer Connection Bug Parade at:
http://developer.java.sun.com/developer/bugParade/index.jshtml

It may take a day or two before your bug shows up in this
external database.
------------------------------------------------------------------

Maybe this is related:
http://developer.java.sun.com/developer/bugParade/bugs/4352983.html

------------------------------------------------------------------
[...]
This is a bug in Swing since Swing caches the font metrics from a screen
context and then assumes they are valid in all contexts. This is incorrect
and needs to be fixed in the code that makes this assumption. eg in the
Swing implementation.

The basic technical issue is that screen fonts at small point sizes are tweaked
by the font vendors to look good at those sizes with the limited number
of pixels available at screen resolution.
At high reslutions such as obtained on printers this isn't scaling exactly
with the graphics transform.
This information is coming from the font in both cases.
There has to be either a compensation for this or an accomodation of it.
The usually accepted method is to measure text for the context in which
its going to be displayed. In this case swing is measuring at screen resolution
but displaying at printer resolution.
[...]
------------------------------------------------------------------

Bernd



By: Bernd Proissl - berndproissl
RE:: java printing issues
2002-08-27 03:09
http://developer.java.sun.com/developer/bugParade/bugs/4727913.html
http://developer.java.sun.com/developer/bugParade/bugs/4480930.html
2001 JI Open Discussion's picture
Joined: Aug 10 2006 - 3:26am
Last seen: 16 years 10 months ago

0 Answers:

No answers yet
Feedback