[
https://issues.apache.org/jira/browse/PDFBOX-5179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17333049#comment-17333049
]
Michael Carell commented on PDFBOX-5179:
----------------------------------------
One additional comment. The solution for the bug in my programm was to take the
page rotation into accout:
{color:#0033b3}int {color}{color:#000000}pageRotation {color}=
({color:#0033b3}int{color}) {color:#000000}page{color}.getRotation();
{color:#000000}Matrix ctmNew {color}=
getGraphicsState().getCurrentTransformationMatrix();
{color:#0033b3}int {color}{color:#000000}objectRotation {color}=
({color:#0033b3}int{color})
{color:#000000}Math{color}.round({color:#000000}Math{color}.toDegrees({color:#000000}Math{color}.atan2({color:#000000}ctmNew{color}.getShearY(),
{color:#000000}ctmNew{color}.getScaleY())));
{color:#0033b3}int {color}{color:#000000}trueRotation {color}=
{color:#000000}objectRotation {color}- {color:#000000}pageRotation{color};
If pageRotation is 90° and imageRotation ist 90° the true rotation is 0°. In
this case the image is extracted as displayed.
> PDFBox PrintImageLocations: Extracts images in wrong orientation
> ----------------------------------------------------------------
>
> Key: PDFBOX-5179
> URL: https://issues.apache.org/jira/browse/PDFBOX-5179
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 2.0.21
> Environment: Windows 10, Tomcat 9, jdk 1.8_0161
> Reporter: Michael Carell
> Priority: Major
> Attachments: 0137d7db-7ca3-4573-a73a-1386699d922c.jpeg,
> Testdokument.pdf, org_0137d7db-7ca3-4573-a73a-1386699d922c.jpeg
>
>
> The PrintImageLocation class writes images in the original and rotated
> format. I used the algorithm in a image processing application. I found some
> PDF documents, where the extracted pictures have a wrong orientation. I have
> build a document to test that case.
> How to reproduce:
> I have constructed a MS Word document, that contains 4 images with different
> rotation levels (0°, 90°, 180°, 270°). I exported the document to PDF format.
> If you call PrintImageLocation with that PDF, the pictures within the
> document, that are rotated are displayed in in the right order and the
> "rotate" images, have the orientation from the document.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]