Hi,
Am 05.12.2012 14:49, schrieb Gerrit Lober:
Dear all,
I've the following problem with PDFbox. I try to paint a rectangle with
PDPageContentStream and then put a figure in the center of this rectangle.
Therefore I try to calculate the width of the text. The Method getStringWidth
returns everytime the same width for all figures. That means that
I get the same result for "12" and "32". Because the "1" is smaller than the "3"
something is not correct and my "12" is a bit to right.
What is the reason for this?
You are right, helvetica is a proportional font (the character width may vary)
but according to the afm-metric file (helvetica.afm) all figures have the same
with of 556. So far so good. Where do you see the displacement, in adobe reader
or when printing?
I get the Font with the following code:
private PDFont getFont() throws IOException {
return PDType1Font.HELVETICA;
}
Thanks!
BR
Andreas Lehmkühler