pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilad Denneboom <gilad.denneb...@gmail.com>
Subject Re: Move rotated text to center of page
Date Tue, 24 Jan 2017 22:31:47 GMT
Yes, I'm familiar with the Pythagorean theorem...

On Tue, Jan 24, 2017 at 11:30 PM, Tilman Hausherr <THausherr@t-online.de>
wrote:

> Am 24.01.2017 um 23:20 schrieb Gilad Denneboom:
>
>> Thanks, but surely PDFont.getStringWidth() will return the width of the
>> text string on its own, not of the rect that surrounds it when it is
>> rotated, right?
>>
>
> No. You'll need to so some math (cosine).
>
> https://en.wikipedia.org/wiki/Trigonometric_functions
>
> Tilman
>
>
>
>
>> On Tue, Jan 24, 2017 at 11:02 PM, Tilman Hausherr <THausherr@t-online.de>
>> wrote:
>>
>> Am 24.01.2017 um 22:53 schrieb Gilad Denneboom:
>>>
>>> I can't figure out
>>>> how the moveTextPositionByAmount works...
>>>>
>>>> It is relative to the previous position since the start of the text
>>> mode.
>>> It starts at 0,0.
>>>
>>> Basically what I would like is to be able to calculate the height and
>>> width
>>>
>>>> of the text, so I could figure out where on the page to place it so that
>>>> the center of both objects are aligned.
>>>>
>>>>
>>> See the DrawPrintTextLocations example on how to calculate the height.
>>> It's quite tricky. The width you can get by PDFont.getStringWidth().
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message