This is a Java problem. At first I thought that iText was not providing the
correct metrics but the sad reality is that all the apps get the metrics
from Java elsewhere and not from the Graphics2D they are writing to as they
should. The solution is to make the PDF metrics the same as Java. It's in my
to-do list with low priority.
Instead of using layout.draw() you can use
PdfContentByte.createGraphicsShapes() that will translate drawString() into
layout.draw(). It's just a convenience.
For the screen appearance turn on font smoothing in Acrobat.

Best Regards,
Paulo Soares

> -----Original Message-----
> From: Yishai Steinhart [SMTP:[EMAIL PROTECTED]
> Sent: Thursday, October 09, 2003 2:56
> To:   [EMAIL PROTECTED]
> Subject:      [iText-questions] g.DrawString vs. layout.draw
> 
> I create a PDF file using the PdfGraphics2D. I draw text is one of two
> ways.
>       1. g.drawString (myString, pen.x, pen.y);
>       2. layout.draw((Graphics2D) g, pen.x, pen.y);
> 
> When I use drawString, the text (in the PDF file) looks nice and smooth.
> However, its measurements are wrong. It depends on the size and the style,
> but if the text is right justified the right edge might move by as many as
> 20-40 pixels per line and  the text will be clipped out of the page or not
> justified.
> 
> When I use layout.draw the measurement is correct. Text draws where it
> needs
> to etc, however, the text looks very 'jaggy', as if it is drawn for a 36
> DPI
> screen. The resolution is there, and if you zoom into the file you see
> that
> the resolution is there. Even more, it prints okay. This is just a screen
> problem.
> 
> I am sure this is not an iText problem but a Java problem, as it happens
> to
> me when I use other print drivers to generate the PDF.
> 
> Does anyone have trick how to make the text drawn with layout.draw look
> nice
> on the screen as well (or to make drawString measure correctly)? If I
> would
> like to use the PDF as a proof, it should look as it will print.
> 
> Thanks
> 
> -Yishai Steinhart
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> SourceForge.net hosts over 70,000 Open Source Projects.
> See the people who have HELPED US provide better services:
> Click here: http://sourceforge.net/supporters.php
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to