Hi,
Am 18.02.2014 22:26, schrieb Bose, Nilanjan - New Delhi:
Hi,
Please find my requirement as mentioned below:
"Need to check rotation angle of an Image embedded in a PDF.I am currently using
PDFBOX 1.8.3 version."
I have checked and found currently there is no API which returns me the
rotation matrix for an image.
I did investigate PDGraphicsState.getCurrentTransformationMatrix(). This
returns org.apache.pdfbox.util.Matrix. This contains methods for extracting the
scaling and translation matrices, but strangely, it does not contain any method
to get the rotation matrix.
Can anyone please tell me how to get rotation matrix for an image.
PDF uses a matrix qith six elements representing any possible transformation as
scaling, rotation and translation.
The pdf spec provides the following short description for possible combinations
of matrix values in chapter 8.3.3:
- Translations shall be specified as [ 1 0 0 1 t x t y ], where t x and t y
shall be the distances to translate the
origin of the coordinate system in the horizontal and vertical dimensions,
respectively.
- Scaling shall be obtained by [ s x 0 0 s y 0 0 ]. This scales the coordinates
so that 1 unit in the horizontal
and vertical dimensions of the new coordinate system is the same size as s x and
s y units, respectively, in
the previous coordinate system.
- Rotations shall be produced by [ cos q sin q -sin q cos q 0 0 ], which has the
effect of rotating the
coordinate system axes by an angle q counter clockwise.
- Skew shall be specified by [ 1 tan a tan b 1 0 0 ], which skews the x axis by
an angle a and the y axis by
an angle b.
Wikipedia provides a more technical description [1]
Thanks,
Nilanjan
BR
Andreas Lehmkühler
[1] http://en.wikipedia.org/wiki/Transformation_matrix