If it doesn't work, please share your PDF


Am 11.04.2018 um 16:17 schrieb Peter Pinnau:
I want to determine if the first page of a document contains a PDImageXObject which fills the whole page.

I found that piece of code with PDFStreamEngine:

My implementation works so far and finds the PDImageXObject:

if( xobject instanceof PDImageXObject)
       PDImageXObject image = (PDImageXObject) xobject;

       Matrix ctmNew = getGraphicsState().getCurrentTransformationMatrix();

       System.out.println(image.getWidth() + " * " + image.getHeight());

       imageDim = new PDRectangle();

I want to compare the imageDim with the CropBox of the page. The CropBox for my A4 test doc is 595.2 x 841.92 as expected.

Since it is a 300dpi scan the pixel size of the image is 2480 * 3508.

My problem is that ctmNew.getScalingFactorX() and ctmNew.getScalingFactorY() both returns 1.0

How can I find out the display size of the image in user space units or at least the resolution which the image is rendered within the PDF?

The final goal is a routine which guesses if it is a scanned document (which my contain text data from OCR) or a pure digital PDF (not scanned).


To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to