You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by chitgoks <ch...@gmail.com> on 2018/01/08 23:55:12 UTC

media box with rotation

tilman mentioned this before that there is no convenience method available

just wondering if anyone else made this work?

i need a rectangle returned based on page orientation

@maruan did you come across this case scenario?

Re: media box with rotation

Posted by chitgoks <ch...@gmail.com>.
Could that vertical area where the annotations are not rotated as well be
some kind of bounding box?

maybe it is possible to rotate that if it is indeed found within some kind
of container.

On Wed, Jan 10, 2018 at 8:42 PM, Maruan Sahyoun <sa...@fileaffairs.de>
wrote:

> Hi,
> > Am 10.01.2018 um 12:41 schrieb chitgoks <ch...@gmail.com>:
> >
> > Hi maruan
> >
> > i tried it like this
> >
> > PDRectangle rectToUse = pdPage.getMediaBox();
> >
> >                 if (pdPage.getRotation() != 0 && pdPage.getRotation() !=
> 180)
> >                     rectToUse = new PDRectangle(0, 0,
> pdPage.getMediaBox().getHeight(), pdPage.getMediaBox().getWidth());
> >
> > the annotations do not get rotated. they do not have the NO ROTATE flag.
> >
> > does this mean i have to manually recalculate the coordinates?
>
> Yes
>
> BR
> Maruan
>
>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> > For additional commands, e-mail: users-help@pdfbox.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Re: media box with rotation

Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
Hi,
> Am 10.01.2018 um 12:41 schrieb chitgoks <ch...@gmail.com>:
> 
> Hi maruan
> 
> i tried it like this
> 
> PDRectangle rectToUse = pdPage.getMediaBox();
>                 
>                 if (pdPage.getRotation() != 0 && pdPage.getRotation() != 180)
>                     rectToUse = new PDRectangle(0, 0, pdPage.getMediaBox().getHeight(), pdPage.getMediaBox().getWidth());
> 
> the annotations do not get rotated. they do not have the NO ROTATE flag.
> 
> does this mean i have to manually recalculate the coordinates?

Yes

BR
Maruan


> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: media box with rotation

Posted by chitgoks <ch...@gmail.com>.
Hi maruan

i tried it like this

PDRectangle rectToUse = pdPage.getMediaBox();

                if (pdPage.getRotation() != 0 && pdPage.getRotation() !=
180)
                    rectToUse = new PDRectangle(0, 0,
pdPage.getMediaBox().getHeight(),
pdPage.getMediaBox().getWidth());

the annotations do not get rotated. they do not have the NO ROTATE flag.

does this mean i have to manually recalculate the coordinates?

Re: media box with rotation

Posted by chitgoks <ch...@gmail.com>.
oh thats it?

lol sorry. my bad. i thought thered be some other things needed in order to
get the correct mediabox dimension

thanks

On Tue, 9 Jan 2018 at 4:33 PM Maruan Sahyoun <sa...@fileaffairs.de> wrote:

> Hi,
>
> > tilman mentioned this before that there is no convenience method
> available
> >
> > just wondering if anyone else made this work?
> >
> > i need a rectangle returned based on page orientation
>
> you need to get the media box and the rotation. If the rotation has a
> value different to 0 you need to swap the dimensions accordingly.
>
> BR
> Maruan
>
>
> >
> > @maruan did you come across this case scenario?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Re: media box with rotation

Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
Hi,
 
> tilman mentioned this before that there is no convenience method available
> 
> just wondering if anyone else made this work?
> 
> i need a rectangle returned based on page orientation

you need to get the media box and the rotation. If the rotation has a
value different to 0 you need to swap the dimensions accordingly. 

BR
Maruan


> 
> @maruan did you come across this case scenario?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org