[ 
https://issues.apache.org/jira/browse/PDFBOX-585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12876324#action_12876324
 ] 

Pepijn Schmitz commented on PDFBOX-585:
---------------------------------------

The second link doesn't work anymore, but having hunted down the source for 
Invoke I must unfortunately admit I don't understand enough of it to fix 
PrintImageLocations myself.

However, using a debugger I determined that in this bit of code from 
PrintImageLocations:

                    Matrix unrotatedCTM = ctm.multiply( rotationInverseMatrix );
                    float xScale = unrotatedCTM.getXScale();
                    float yScale = unrotatedCTM.getYScale();

                    System.out.println( "Found image[" + objectName.getName() + 
"] " +
                            "at " + unrotatedCTM.getXPosition() + "," + 
unrotatedCTM.getYPosition() +
                            " size=" + (xScale/100f*image.getWidth()) + "," + 
(yScale/100f*image.getHeight() ));

...the values of xScale and yScale appear to be the width and height of the 
image in PDF units (or points). I don't know in which units PrintImageLocations 
is trying to show the size (an unfortunate flaw in most of the PDFBox 
documentation), but dividing by 100 and multiplying by the image dimensions 
seems neither here nor there. Dividing by 72 would get you the size in inches, 
multiplying that by 25.4 would result in the size in mm.

Is my understanding correct?

> PrintImageLocations example calculates wrong image width/height
> ---------------------------------------------------------------
>
>                 Key: PDFBOX-585
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-585
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Parsing, PDModel, Utilities
>    Affects Versions: 0.8.0-incubator
>            Reporter: Andreas Lehmkühler
>            Assignee: Andreas Lehmkühler
>
> As described in [1] the code for calculating the image position and 
> width/height should be updated similar to the code in [2].
> [1] http://markmail.org/thread/hzti74yt45vz326r
> [2] 
> http://svn.apache.org/repos/asf/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/Invoke.java
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to