pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Lehmkühler <andr...@lehmi.de>
Subject RE: Image rotation check using PDFBOX (version 1.8.3)
Date Mon, 24 Feb 2014 12:15:06 GMT
Hi,


> "Bose, Nilanjan - New Delhi" <nbose@wiley.com> hat am 19. Februar 2014 um
> 18:25 geschrieben:
>
>
> HI,
> Thanks for your response.
> Yes I knew that but when I am using the following code to get Transformation
> matrix I am getting the output as :
> Code:
> -----------------------
> grpahicsState = new PDGraphicsState(innerPage.findCropBox());
> Matrix matrix = grpahicsState.getCurrentTransformationMatrix();
> System.out.println(matrix);
That doesn't work.

You have to parse the document using something like RenderUtil.convertToImage.
While doing that you have to intercept the draw image call to get the current
transformation matrix. To do so, you have to extend/overwrite the Invoke
operator [1], which is called when an image has to be drawn. Be aware to modify
the operator mapping [2] if you choose to overwrite the exisiting one (the line
starting with "Do" is relevant).

>
> Output:
> ------------------------
> [[1.0,0.0,0.0][0.0,1.0,0.0][0.0,0.0,1.0]]
>
> Please let me know which one stands for Translation and which one is for
> rotation.How to calculate rotation.
> PFA the input PDF file on which I executed the test cases.
>
> Thanks,
> Nilanjan

BR
Andreas Lehmkühler

[1]
http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/pagedrawer/Invoke.java?view=markup
[2]
http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/resources/org/apache/pdfbox/resources/PageDrawer.properties?view=markup

Mime
View raw message