You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by BUSSINGER Fabien <fa...@docapost.fr> on 2015/03/27 08:30:17 UTC

How can i get the image document size?

Hi,

I'm unable to find the way to capture the size of an image in a PDF with v1.8.8 of PDFBox.
I know how to get the real size like 3000px*2000px but I would like to know the way to capture the document relative size. Like 3in*2in for example.
I tried with extending the PDFStreamEngine classe but the value returned didn't seem to be good.

Thanks for the responses


Fabien BUSSINGER
Projets « Elections »
BU DIGITAL PLATFORM
DOCAPOST Grands-Comptes /ETI

[cid:image001.png@01D06867.FD40FFC0]<http://www.docapost.com/>

Les Vaisseaux - Bât C - Rue du Vallon - BP 49 - 06901 Sophia-Antipolis Cedex
Tél. : +33 (0)4 93 95 76 42 - fabien.bussinger@docapost.fr<ma...@docapost.fr>
www.docapost.com<http://www.docapost.com/>

[cid:image002.jpg@01D06867.FD40FFC0]<https://twitter.com/Docapost>[cid:image003.jpg@01D06867.FD40FFC0]<https://www.youtube.com/user/docapostvideos>

DOCAPOST est une filiale du Groupe La Poste
Adoptez l'éco-attitude : n'imprimez que si cela vous semble vraiment nécessaire.


RE: How can i get the image document size?

Posted by BUSSINGER Fabien <fa...@docapost.fr>.
Thanks all.
I missed that point. Stupid me!

-----Message d'origine-----
De : John Hewson [mailto:john@jahewson.com] 
Envoyé : vendredi 27 mars 2015 16:35
À : users@pdfbox.apache.org
Objet : Re: How can i get the image document size?

Divide the px values by the dpi which you rendered the page at (the default is 72).

inches = px / dpi

Alternatively call PDPage.findCropBox() and divide the result by 72.

-- John

> On 27 Mar 2015, at 00:30, BUSSINGER Fabien <fa...@docapost.fr> wrote:
> 
> Hi,
>  
> I’m unable to find the way to capture the size of an image in a PDF with v1.8.8 of PDFBox.
> I know how to get the real size like 3000px*2000px but I would like to know the way to capture the document relative size. Like 3in*2in for example.
> I tried with extending the PDFStreamEngine classe but the value returned didn’t seem to be good.
>  
> Thanks for the responses
>  
>  
> Fabien BUSSINGER
> Projets « Elections »
> BU DIGITAL PLATFORM
> DOCAPOST Grands-Comptes /ETI
>  
> 
>  
> Les Vaisseaux – Bât C – Rue du Vallon – BP 49 – 06901 Sophia-Antipolis 
> Cedex Tél. : +33 (0)4 93 95 76 42 – fabien.bussinger@docapost.fr 
> www.docapost.com
>  
> 
>  
> DOCAPOST est une filiale du Groupe La Poste Adoptez l'éco-attitude : 
> n'imprimez que si cela vous semble vraiment nécessaire.
>  

Re: How can i get the image document size?

Posted by John Hewson <jo...@jahewson.com>.
Divide the px values by the dpi which you rendered the page at (the default is 72).

inches = px / dpi

Alternatively call PDPage.findCropBox() and divide the result by 72.

-- John

> On 27 Mar 2015, at 00:30, BUSSINGER Fabien <fa...@docapost.fr> wrote:
> 
> Hi,
>  
> I’m unable to find the way to capture the size of an image in a PDF with v1.8.8 of PDFBox.
> I know how to get the real size like 3000px*2000px but I would like to know the way to capture the document relative size. Like 3in*2in for example.
> I tried with extending the PDFStreamEngine classe but the value returned didn’t seem to be good.
>  
> Thanks for the responses 
>  
>  
> Fabien BUSSINGER
> Projets « Elections »
> BU DIGITAL PLATFORM
> DOCAPOST Grands-Comptes /ETI
>  
> 
>  
> Les Vaisseaux – Bât C – Rue du Vallon – BP 49 – 06901 Sophia-Antipolis Cedex
> Tél. : +33 (0)4 93 95 76 42 – fabien.bussinger@docapost.fr
> www.docapost.com
>  
> 
>  
> DOCAPOST est une filiale du Groupe La Poste
> Adoptez l'éco-attitude : n'imprimez que si cela vous semble vraiment nécessaire.
>  

Re: How can i get the image document size?

Posted by Tilman Hausherr <TH...@t-online.de>.
Here's some code that shows the size in inches:
http://stackoverflow.com/a/12315820/535646

It is from the PrintImageLocations.java sample code.

Not sure what you mean with "relative" size.

Tilman

Am 27.03.2015 um 08:30 schrieb BUSSINGER Fabien:
>
> Hi,
>
> I’m unable to find the way to capture the size of an image in a 
> PDF with v1.8.8 of PDFBox.
>
> I know how to get the real size like 3000px*2000px but I would like to 
> know the way to capture the document relative size. Like 3in*2in for 
> example.
>
> I tried with extending the PDFStreamEngineclasse but the value 
> returned didn’t seem to be good.
>
> Thanks for the responses
>
> *Fabien BUSSINGER*
>
> Projets « Elections »
>
> BU DIGITAL PLATFORM
>
> DOCAPOST Grands-Comptes /ETI
>
> *Description : Description : Description : Description : Description : 
> T:\Costa\_Private\_DOCAPOST 2012\Chartes\LOGOS\DOCAPOST\LOGO 
> DOCAPOST.png* <http://www.docapost.com/>**
>
> **
>
> Les Vaisseaux – Bât C – Rue du Vallon – BP 49 – 06901 Sophia-Antipolis 
> Cedex
>
> Tél. : +33 (0)4 93 95 76 42 – fabien.bussinger@docapost.fr 
> <ma...@docapost.fr>
>
> www.docapost.com <http://www.docapost.com/>
>
> cid:image010.jpg@01D031C1.1061FA10 
> <https://twitter.com/Docapost>cid:image011.jpg@01D031C1.1061FA10 
> <https://www.youtube.com/user/docapostvideos>
>
> DOCAPOST est une filiale du Groupe La Poste*//*
>
> */Adoptez l'éco-attitude/*/ : n'imprimez que si cela vous semble 
> vraiment nécessaire//./
>