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: PDFbox, converting between points and rendered pixels?
Date Wed, 01 Apr 2015 06:39:46 GMT
Am 01.04.2015 um 06:43 schrieb Andrew Munn:
>>> This method is working somewhat but not exactly.  The drawn boxes are
>>> ending up in the wrong place even though I've measured their pixel
>>> position correctly in the rendered image.  Is there a better way to
>>> accomplish this?
>> Yes, play with the CTM (current transformation matrix)... use transform() and
>> set a ctm that flips... btw, flipping is multiplying with -1 then adding.
>>
> So to convert from pixels in a 720dpi rendered PDF to points in the API do
> I need to do something like this?
>
>   Matrix m = new Matrix();
>   m.scale(0.10f, 0.10f);
>   cos.transform(m);
>
> or do I need to pass in some AffineTransform to the Matrix constructor?

Both is possible.

> Does this transform mean I no longer need the flip?

The flip was for a different reason, which you explained in a previous post.

What I mean is that it is easier to use a transform, than to do 
calculations yourself.

Tilman

>
> Thanks!
>
> ---------------------------------------------------------------------
> 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
View raw message