You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Leonard Teo <le...@ballistiq.com> on 2013/12/09 17:14:10 UTC

Get visible page dimensions/PDRectangle instead of Media Box?

Hi guys,

I have an interesting issue where a client has combined PDF files but one
particular PDF is cropped so that half of the page is missing.

When I get the page width using findMediaBox(), it is getting the width of
the Media Box of the page, instead of what is actually visible.

PDRectangle pageSize = page.findMediaBox();
float pageWidth = pageSize.getWidth();

Do you guys know what would be a way of getting the actual visible page
dimensions?

The culprit PDF file is below. If you open this in Acrobat, it appears to
be a single page. If you open it in Adobe Illustrator, you'll see that it's
actually a double page spread.

https://www.dropbox.com/s/3h041kh6eac002m/livre_Gestion_Fraude_2-COVER.pdf

Thanks!

Leonard

--
Leonard Teo
CEO, Partner
Ballistiq Digital Inc.
http://www.ballistiq.com

Re: Get visible page dimensions/PDRectangle instead of Media Box?

Posted by Leonard Teo <le...@ballistiq.com>.
Ah you are right. The findCropBox method gets the correct dimensions.

Thank you!

Leonard

--
Leonard Teo
CEO, Partner
Ballistiq Digital Inc.
http://www.ballistiq.com

ArtStation - A website for every artist
http://www.artstation.com


On Mon, Dec 9, 2013 at 11:20 AM, Maruan Sahyoun <sa...@fileaffairs.de>wrote:

> did you check the other box definitions. Maybe the PDF is cropped.
> page.findCropBox();
>
> BR
> Maruan Sahyoun
>
> Am 09.12.2013 um 17:14 schrieb Leonard Teo <le...@ballistiq.com>:
>
> > Hi guys,
> >
> > I have an interesting issue where a client has combined PDF files but one
> > particular PDF is cropped so that half of the page is missing.
> >
> > When I get the page width using findMediaBox(), it is getting the width
> of
> > the Media Box of the page, instead of what is actually visible.
> >
> > PDRectangle pageSize = page.findMediaBox();
> > float pageWidth = pageSize.getWidth();
> >
> > Do you guys know what would be a way of getting the actual visible page
> > dimensions?
> >
> > The culprit PDF file is below. If you open this in Acrobat, it appears to
> > be a single page. If you open it in Adobe Illustrator, you'll see that
> it's
> > actually a double page spread.
> >
> >
> https://www.dropbox.com/s/3h041kh6eac002m/livre_Gestion_Fraude_2-COVER.pdf
> >
> > Thanks!
> >
> > Leonard
> >
> > --
> > Leonard Teo
> > CEO, Partner
> > Ballistiq Digital Inc.
> > http://www.ballistiq.com
>
>

Re: Get visible page dimensions/PDRectangle instead of Media Box?

Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
did you check the other box definitions. Maybe the PDF is cropped. page.findCropBox();

BR
Maruan Sahyoun

Am 09.12.2013 um 17:14 schrieb Leonard Teo <le...@ballistiq.com>:

> Hi guys,
> 
> I have an interesting issue where a client has combined PDF files but one
> particular PDF is cropped so that half of the page is missing.
> 
> When I get the page width using findMediaBox(), it is getting the width of
> the Media Box of the page, instead of what is actually visible.
> 
> PDRectangle pageSize = page.findMediaBox();
> float pageWidth = pageSize.getWidth();
> 
> Do you guys know what would be a way of getting the actual visible page
> dimensions?
> 
> The culprit PDF file is below. If you open this in Acrobat, it appears to
> be a single page. If you open it in Adobe Illustrator, you'll see that it's
> actually a double page spread.
> 
> https://www.dropbox.com/s/3h041kh6eac002m/livre_Gestion_Fraude_2-COVER.pdf
> 
> Thanks!
> 
> Leonard
> 
> --
> Leonard Teo
> CEO, Partner
> Ballistiq Digital Inc.
> http://www.ballistiq.com