You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Gerrit Lober <ge...@gmx.de> on 2012/12/04 13:16:22 UTC
Problem with PDFont.getStringWidth()
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?
I get the Font with the following code:
private PDFont getFont() throws IOException {
return PDType1Font.HELVETICA;
}
Thanks!
Re: Problem with PDFont.getStringWidth()
Posted by jl...@gi-bon.sk.
hi,
this bug is probably solved here:
https://issues.apache.org/jira/browse/PDFBOX-1408
best regards
Juraj Lonc
From: "Gerrit Lober" <ge...@gmx.de>
To: users@pdfbox.apache.org,
Date: 04. 12. 2012 15:42
Subject: Problem with PDFont.getStringWidth()
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?
I get the Font with the following code:
private PDFont getFont() throws IOException {
return PDType1Font.HELVETICA;
}
Thanks!