pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: Drawing rotated image in a content stream
Date Thu, 12 Jan 2017 17:19:42 GMT
Am 12.01.2017 um 18:17 schrieb Tilman Hausherr:
> Am 12.01.2017 um 13:38 schrieb Ján Kaššovic:
>> Hi,
>>
>> I consider the following more as a bug/feature request, but since I 
>> am not
>> sure I start here. I have ended up with a need to use deprecated
>> PDPageContentStream.drawXObject since I need to rotate the 
>> PDImageXObject
>> which I am drawing. The nondeprecated methods just hide the 
>> transformation
>> inside, which I find unfortunate.
>> If there is a better way to do so, please let me know.
>
> This is more a documentation problem.... I've improved the javadoc for 
> next version.
>
> call
>
> cs.drawImage(img, Matrix.getRotateInstance(Math.toRadians(45), ..., 
> ....));
>
>
> note that rotation is done around (0,0) so you need to do a 
> translation too 

Oops it's more complex, you need to scale for the image size too. So you 
need to pass a matrix that has both the rotation, the translation and 
the scale.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message