You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Gilad Denneboom <gi...@gmail.com> on 2012/11/10 15:04:47 UTC

Reset Page Rotation (w/o actually rotating the page)

Hi guys,

I hope someone can help me out with this annoying issue...
I'm adding highlights to a page and they come out in the wrong location.
I've discovered the reason is that some pages are rotated, but the
coordinates of the highlights are not in the rotated user space.
The ideal solution for me would be to reset the rotation definition of the
page without actually rotating it... The only other option I can think of
would be to convert the coordinates I have, which is quite a complex
operation, it seems.

Any ideas on how to do that?

Thanks in advance!
Gilad

Re: Reset Page Rotation (w/o actually rotating the page)

Posted by Gilad Denneboom <gi...@gmail.com>.
OK, if it's so simple, would you mind sharing with me the code that does it?


On Mon, Nov 12, 2012 at 3:40 PM, <jl...@gi-bon.sk> wrote:

> hi gilad,
> i think you already got answer.
>
> the best way is to read findRotation() and then recalculate coordinates of
> rectangle you want to add.
> this is very simple and easy to do. i don't think you will find any
> simpler solution.
>
>
>
> Best regards
> Juraj Lonc
>
>
>
>
> From:   Gilad Denneboom <gi...@gmail.com>
> To:     "users@pdfbox.apache.org" <us...@pdfbox.apache.org>,
> Date:   12. 11. 2012 15:33
> Subject:        Re: Reset Page Rotation (w/o actually rotating the page)
>
>
>
> Any other ideas from anyone?
>
>
> On Sun, Nov 11, 2012 at 7:08 PM, Duane Nickull <
> duane@technoracle-systems.com> wrote:
>
> > THat would still involve using the findRotation() method to determine if
> > if it rotated then using another method to rotate it.  It should be only
> a
> > few hours work at most.  I believe there is a setRotation() method in
> the
> > same class.
> >
> > Duane Nickull
> > ***********************************
> > Technoracle Advanced Systems Inc.
> > Consulting and Contracting; Proven Results!
> > i.  Neo4J, PDF, Java, LiveCycle ES, Flex, AIR, CQ5 & Mobile
> > b. http://technoracle.blogspot.com
> > t.  @duanechaos
> > "Don't fear the Graph!  Embrace Neo4J"
> >
> >
> >
> >
> >
> >
> > On 2012-11-10 2:00 PM, "Gilad Denneboom" <gi...@gmail.com>
> > wrote:
> >
> > >Thanks for the reply, but that's not exactly what I mean... I'm trying
> > >avoiding having to write such a utility class (as it proves quite
> complex)
> > >by simply resetting the rotation setting of the page, since my code
> works
> > >fine with non-rotated pages. So I want to set the rotation to 0,
> without
> > >actually rotating the contents of the page. Possible?
> > >
> > >
> > >On Sat, Nov 10, 2012 at 6:43 PM, Duane Nickull <
> > >duane@technoracle-systems.com> wrote:
> > >
> > >> There is a method in the API's called CreateLandscapePDF() that can
> > >>make a
> > >> page landscape (presume that is what you mean by rotated).   PDPage
> also
> > >> has a findRotation() method if you require data.    YOu may have to
> > >>build
> > >> a utility class that can re-calculate the x, y, height, width coords
> and
> > >> call it based on the results of the findRotation() method.
> > >>
> > >> Hope this helps.
> > >>
> > >> Duane
> > >>
> > >>
> > >> ***********************************
> > >> Technoracle Advanced Systems Inc.
> > >> Consulting and Contracting; Proven Results!
> > >> i.  Neo4J, PDF, Java, LiveCycle ES, Flex, AIR, CQ5 & Mobile
> > >> b. http://technoracle.blogspot.com
> > >> t.  @duanechaos
> > >> "Don't fear the Graph!  Embrace Neo4J"
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >> On 2012-11-10 6:04 AM, "Gilad Denneboom" <gi...@gmail.com>
> > >> wrote:
> > >>
> > >> >Hi guys,
> > >> >
> > >> >I hope someone can help me out with this annoying issue...
> > >> >I'm adding highlights to a page and they come out in the wrong
> > >>location.
> > >> >I've discovered the reason is that some pages are rotated, but the
> > >> >coordinates of the highlights are not in the rotated user space.
> > >> >The ideal solution for me would be to reset the rotation definition
> of
> > >>the
> > >> >page without actually rotating it... The only other option I can
> think
> > >>of
> > >> >would be to convert the coordinates I have, which is quite a complex
> > >> >operation, it seems.
> > >> >
> > >> >Any ideas on how to do that?
> > >> >
> > >> >Thanks in advance!
> > >> >Gilad
> > >>
> > >>
> > >>
> >
> >
> >
>
>

Re: Reset Page Rotation (w/o actually rotating the page)

Posted by jl...@gi-bon.sk.
hi gilad,
i think you already got answer.

the best way is to read findRotation() and then recalculate coordinates of 
rectangle you want to add.
this is very simple and easy to do. i don't think you will find any 
simpler solution.



Best regards
Juraj Lonc




From:   Gilad Denneboom <gi...@gmail.com>
To:     "users@pdfbox.apache.org" <us...@pdfbox.apache.org>, 
Date:   12. 11. 2012 15:33
Subject:        Re: Reset Page Rotation (w/o actually rotating the page)



Any other ideas from anyone?


On Sun, Nov 11, 2012 at 7:08 PM, Duane Nickull <
duane@technoracle-systems.com> wrote:

> THat would still involve using the findRotation() method to determine if
> if it rotated then using another method to rotate it.  It should be only 
a
> few hours work at most.  I believe there is a setRotation() method in 
the
> same class.
>
> Duane Nickull
> ***********************************
> Technoracle Advanced Systems Inc.
> Consulting and Contracting; Proven Results!
> i.  Neo4J, PDF, Java, LiveCycle ES, Flex, AIR, CQ5 & Mobile
> b. http://technoracle.blogspot.com
> t.  @duanechaos
> "Don't fear the Graph!  Embrace Neo4J"
>
>
>
>
>
>
> On 2012-11-10 2:00 PM, "Gilad Denneboom" <gi...@gmail.com>
> wrote:
>
> >Thanks for the reply, but that's not exactly what I mean... I'm trying
> >avoiding having to write such a utility class (as it proves quite 
complex)
> >by simply resetting the rotation setting of the page, since my code 
works
> >fine with non-rotated pages. So I want to set the rotation to 0, 
without
> >actually rotating the contents of the page. Possible?
> >
> >
> >On Sat, Nov 10, 2012 at 6:43 PM, Duane Nickull <
> >duane@technoracle-systems.com> wrote:
> >
> >> There is a method in the API's called CreateLandscapePDF() that can
> >>make a
> >> page landscape (presume that is what you mean by rotated).   PDPage 
also
> >> has a findRotation() method if you require data.    YOu may have to
> >>build
> >> a utility class that can re-calculate the x, y, height, width coords 
and
> >> call it based on the results of the findRotation() method.
> >>
> >> Hope this helps.
> >>
> >> Duane
> >>
> >>
> >> ***********************************
> >> Technoracle Advanced Systems Inc.
> >> Consulting and Contracting; Proven Results!
> >> i.  Neo4J, PDF, Java, LiveCycle ES, Flex, AIR, CQ5 & Mobile
> >> b. http://technoracle.blogspot.com
> >> t.  @duanechaos
> >> "Don't fear the Graph!  Embrace Neo4J"
> >>
> >>
> >>
> >>
> >>
> >>
> >> On 2012-11-10 6:04 AM, "Gilad Denneboom" <gi...@gmail.com>
> >> wrote:
> >>
> >> >Hi guys,
> >> >
> >> >I hope someone can help me out with this annoying issue...
> >> >I'm adding highlights to a page and they come out in the wrong
> >>location.
> >> >I've discovered the reason is that some pages are rotated, but the
> >> >coordinates of the highlights are not in the rotated user space.
> >> >The ideal solution for me would be to reset the rotation definition 
of
> >>the
> >> >page without actually rotating it... The only other option I can 
think
> >>of
> >> >would be to convert the coordinates I have, which is quite a complex
> >> >operation, it seems.
> >> >
> >> >Any ideas on how to do that?
> >> >
> >> >Thanks in advance!
> >> >Gilad
> >>
> >>
> >>
>
>
>


Re: Reset Page Rotation (w/o actually rotating the page)

Posted by Gilad Denneboom <gi...@gmail.com>.
Any other ideas from anyone?


On Sun, Nov 11, 2012 at 7:08 PM, Duane Nickull <
duane@technoracle-systems.com> wrote:

> THat would still involve using the findRotation() method to determine if
> if it rotated then using another method to rotate it.  It should be only a
> few hours work at most.  I believe there is a setRotation() method in the
> same class.
>
> Duane Nickull
> ***********************************
> Technoracle Advanced Systems Inc.
> Consulting and Contracting; Proven Results!
> i.  Neo4J, PDF, Java, LiveCycle ES, Flex, AIR, CQ5 & Mobile
> b. http://technoracle.blogspot.com
> t.  @duanechaos
> "Don't fear the Graph!  Embrace Neo4J"
>
>
>
>
>
>
> On 2012-11-10 2:00 PM, "Gilad Denneboom" <gi...@gmail.com>
> wrote:
>
> >Thanks for the reply, but that's not exactly what I mean... I'm trying
> >avoiding having to write such a utility class (as it proves quite complex)
> >by simply resetting the rotation setting of the page, since my code works
> >fine with non-rotated pages. So I want to set the rotation to 0, without
> >actually rotating the contents of the page. Possible?
> >
> >
> >On Sat, Nov 10, 2012 at 6:43 PM, Duane Nickull <
> >duane@technoracle-systems.com> wrote:
> >
> >> There is a method in the API's called CreateLandscapePDF() that can
> >>make a
> >> page landscape (presume that is what you mean by rotated).   PDPage also
> >> has a findRotation() method if you require data.    YOu may have to
> >>build
> >> a utility class that can re-calculate the x, y, height, width coords and
> >> call it based on the results of the findRotation() method.
> >>
> >> Hope this helps.
> >>
> >> Duane
> >>
> >>
> >> ***********************************
> >> Technoracle Advanced Systems Inc.
> >> Consulting and Contracting; Proven Results!
> >> i.  Neo4J, PDF, Java, LiveCycle ES, Flex, AIR, CQ5 & Mobile
> >> b. http://technoracle.blogspot.com
> >> t.  @duanechaos
> >> "Don't fear the Graph!  Embrace Neo4J"
> >>
> >>
> >>
> >>
> >>
> >>
> >> On 2012-11-10 6:04 AM, "Gilad Denneboom" <gi...@gmail.com>
> >> wrote:
> >>
> >> >Hi guys,
> >> >
> >> >I hope someone can help me out with this annoying issue...
> >> >I'm adding highlights to a page and they come out in the wrong
> >>location.
> >> >I've discovered the reason is that some pages are rotated, but the
> >> >coordinates of the highlights are not in the rotated user space.
> >> >The ideal solution for me would be to reset the rotation definition of
> >>the
> >> >page without actually rotating it... The only other option I can think
> >>of
> >> >would be to convert the coordinates I have, which is quite a complex
> >> >operation, it seems.
> >> >
> >> >Any ideas on how to do that?
> >> >
> >> >Thanks in advance!
> >> >Gilad
> >>
> >>
> >>
>
>
>

Re: Reset Page Rotation (w/o actually rotating the page)

Posted by Duane Nickull <du...@technoracle-systems.com>.
THat would still involve using the findRotation() method to determine if
if it rotated then using another method to rotate it.  It should be only a
few hours work at most.  I believe there is a setRotation() method in the
same class.

Duane Nickull
***********************************
Technoracle Advanced Systems Inc.
Consulting and Contracting; Proven Results!
i.  Neo4J, PDF, Java, LiveCycle ES, Flex, AIR, CQ5 & Mobile
b. http://technoracle.blogspot.com
t.  @duanechaos
"Don't fear the Graph!  Embrace Neo4J"






On 2012-11-10 2:00 PM, "Gilad Denneboom" <gi...@gmail.com> wrote:

>Thanks for the reply, but that's not exactly what I mean... I'm trying
>avoiding having to write such a utility class (as it proves quite complex)
>by simply resetting the rotation setting of the page, since my code works
>fine with non-rotated pages. So I want to set the rotation to 0, without
>actually rotating the contents of the page. Possible?
>
>
>On Sat, Nov 10, 2012 at 6:43 PM, Duane Nickull <
>duane@technoracle-systems.com> wrote:
>
>> There is a method in the API's called CreateLandscapePDF() that can
>>make a
>> page landscape (presume that is what you mean by rotated).   PDPage also
>> has a findRotation() method if you require data.    YOu may have to
>>build
>> a utility class that can re-calculate the x, y, height, width coords and
>> call it based on the results of the findRotation() method.
>>
>> Hope this helps.
>>
>> Duane
>>
>>
>> ***********************************
>> Technoracle Advanced Systems Inc.
>> Consulting and Contracting; Proven Results!
>> i.  Neo4J, PDF, Java, LiveCycle ES, Flex, AIR, CQ5 & Mobile
>> b. http://technoracle.blogspot.com
>> t.  @duanechaos
>> "Don't fear the Graph!  Embrace Neo4J"
>>
>>
>>
>>
>>
>>
>> On 2012-11-10 6:04 AM, "Gilad Denneboom" <gi...@gmail.com>
>> wrote:
>>
>> >Hi guys,
>> >
>> >I hope someone can help me out with this annoying issue...
>> >I'm adding highlights to a page and they come out in the wrong
>>location.
>> >I've discovered the reason is that some pages are rotated, but the
>> >coordinates of the highlights are not in the rotated user space.
>> >The ideal solution for me would be to reset the rotation definition of
>>the
>> >page without actually rotating it... The only other option I can think
>>of
>> >would be to convert the coordinates I have, which is quite a complex
>> >operation, it seems.
>> >
>> >Any ideas on how to do that?
>> >
>> >Thanks in advance!
>> >Gilad
>>
>>
>>



Re: Reset Page Rotation (w/o actually rotating the page)

Posted by Gilad Denneboom <gi...@gmail.com>.
Thanks for the reply, but that's not exactly what I mean... I'm trying
avoiding having to write such a utility class (as it proves quite complex)
by simply resetting the rotation setting of the page, since my code works
fine with non-rotated pages. So I want to set the rotation to 0, without
actually rotating the contents of the page. Possible?


On Sat, Nov 10, 2012 at 6:43 PM, Duane Nickull <
duane@technoracle-systems.com> wrote:

> There is a method in the API's called CreateLandscapePDF() that can make a
> page landscape (presume that is what you mean by rotated).   PDPage also
> has a findRotation() method if you require data.    YOu may have to build
> a utility class that can re-calculate the x, y, height, width coords and
> call it based on the results of the findRotation() method.
>
> Hope this helps.
>
> Duane
>
>
> ***********************************
> Technoracle Advanced Systems Inc.
> Consulting and Contracting; Proven Results!
> i.  Neo4J, PDF, Java, LiveCycle ES, Flex, AIR, CQ5 & Mobile
> b. http://technoracle.blogspot.com
> t.  @duanechaos
> "Don't fear the Graph!  Embrace Neo4J"
>
>
>
>
>
>
> On 2012-11-10 6:04 AM, "Gilad Denneboom" <gi...@gmail.com>
> wrote:
>
> >Hi guys,
> >
> >I hope someone can help me out with this annoying issue...
> >I'm adding highlights to a page and they come out in the wrong location.
> >I've discovered the reason is that some pages are rotated, but the
> >coordinates of the highlights are not in the rotated user space.
> >The ideal solution for me would be to reset the rotation definition of the
> >page without actually rotating it... The only other option I can think of
> >would be to convert the coordinates I have, which is quite a complex
> >operation, it seems.
> >
> >Any ideas on how to do that?
> >
> >Thanks in advance!
> >Gilad
>
>
>

Re: Reset Page Rotation (w/o actually rotating the page)

Posted by Duane Nickull <du...@technoracle-systems.com>.
There is a method in the API's called CreateLandscapePDF() that can make a
page landscape (presume that is what you mean by rotated).   PDPage also
has a findRotation() method if you require data.    YOu may have to build
a utility class that can re-calculate the x, y, height, width coords and
call it based on the results of the findRotation() method.

Hope this helps.

Duane
 

***********************************
Technoracle Advanced Systems Inc.
Consulting and Contracting; Proven Results!
i.  Neo4J, PDF, Java, LiveCycle ES, Flex, AIR, CQ5 & Mobile
b. http://technoracle.blogspot.com
t.  @duanechaos
"Don't fear the Graph!  Embrace Neo4J"






On 2012-11-10 6:04 AM, "Gilad Denneboom" <gi...@gmail.com> wrote:

>Hi guys,
>
>I hope someone can help me out with this annoying issue...
>I'm adding highlights to a page and they come out in the wrong location.
>I've discovered the reason is that some pages are rotated, but the
>coordinates of the highlights are not in the rotated user space.
>The ideal solution for me would be to reset the rotation definition of the
>page without actually rotating it... The only other option I can think of
>would be to convert the coordinates I have, which is quite a complex
>operation, it seems.
>
>Any ideas on how to do that?
>
>Thanks in advance!
>Gilad