We have a Java application that draws text. The text is drawn in a pre-calculated position, using either Java or platform-native fonts. As an option, the same program can be used to create PDF document; for expediency and code compatibility we use PdfContentByte and PdfTemplate classes; this provides us with the Graphics2D object that we simply substitute into the existing drawing code, and the original Java code generates the PDF document.
It all works fine, except for one problem: the program must calculate the width of the text string in order to position it on the page. This in turn depends on the selected font - an herein lies the problem. Fonts used by iText differ from the originally selected Java fonts, and string width calculated on the basis of Java fonts comes out wrong when the PDF document is generated, which in turn screws up the text positioning. I could solve the problem if I knew what fonts are used by iText as substitute to the original Java fonts. For example, I would like to know what font iText uses when the Graphics2D is set to font "SansSerif 12", or "Monospace 10" etc. I would then calculate the string width using BaseFont getWidthPoint() method. So, is there a solution to my problem? I will appreciate any help. Alex Molochnikov Gestalt Corporation ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions
