Hi,
The example in exampes/util/PrintImageLocations.java in pdfbox-2.0.0-RC3 seems
faulty.
Would this output more correct values?
if ( xobject instanceof PDImageXObject) {
PDImageXObject image = (PDImageXObject)xobject;
int imageWidth = image.getWidth();
int imageHeight = image.getHeight();
System.out.println("*******************************************************************");
System.out.println("Found image [" + objectName.getName() +
"]");
Matrix ctmNew =
getGraphicsState().getCurrentTransformationMatrix();
float scalingFactorX = ctmNew.getScalingFactorX();
float scalingFactorY = ctmNew.getScalingFactorY();
System.out.println("position = " + ctmNew.getTranslateX() +
", " + ctmNew.getTranslateY());
// size in pixel
System.out.println("size = " + imageWidth + "px, " +
imageHeight + "px");
// size in page units
System.out.println("size = " + imageWidth*scalingFactorX +
"pu, " + imageHeight*scalingFactorY + "pu");
// size in inches
scalingFactorX /= 72;
scalingFactorY /= 72;
System.out.println("size = " + imageWidth*scalingFactorX +
"in, " + imageHeight*scalingFactorY + "in");
// size in millimeter
scalingFactorX *= 25.4;
scalingFactorY *= 25.4;
System.out.println("size = " + imageWidth*scalingFactorX +
"mm, " + imageHeight*scalingFactorY + "mm");
System.out.println();
(…)
How to get the size of the image as it will be actually rendered? The scaling
factor seem to be 1 even if the image is heavily scaled like in this example
pdf:
http://files.m3lite.elanders.com/temp/image2.pdf
I am trying to compute a DPI estimation for each included images, in order to
have an estimation of the print result quality.
/Toël
On 7 jul 2015, at 17:43, Tilman Hausherr
<[email protected]<mailto:[email protected]>> wrote:
Am 07.07.2015 um 10:56 schrieb Manfred Pock:
Hi,
is there a possiblity that i can get the rotation of an PDImageObject.
The rotation of the page is 90 degrees, and it seems to be that the
embedded Pdimage also have this rotation.
How can i get this information from PDImage-Obj?
Not at all. The rotation of an image depends of the CTM (current
transformation matrix). See the PrintImageLocations.java example from
the source code download
https://svn.apache.org/viewvc/pdfbox/branches/1.8/examples/src/main/java/org/apache/pdfbox/examples/util/PrintImageLocations.java?view=markup&sortby=date
you'd have to expand this to output the rotation.
Tilman
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]