pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilad Denneboom <gilad.denneb...@gmail.com>
Subject Re: Rotating a new annotation to match the page's rotation
Date Sat, 26 Mar 2016 21:23:54 GMT
Sorry, I'm not quite following you there...

On Sat, Mar 26, 2016 at 10:21 PM, Maruan Sahyoun <sahyoun@fileaffairs.de>
wrote:

> the Rect is more around. The upper left corner is from where you have to
> calculate as this is the the lower left of the unrotated page.
>
> position.setLowerLeftX(82);   // llx
> position.setLowerLeftY(102);  // lly
> position.setUpperRightX(92);  // urx
> position.setUpperRightY(147); // try
>
> BR
> Maruan
>
> > Am 26.03.2016 um 22:14 schrieb Gilad Denneboom <
> gilad.denneboom@gmail.com>:
> >
> > No luck, I'm afraid... The new quads array is:
> >
> [104.73436,751.22327,104.73436,757.2535,147.8024,751.22327,147.8024,757.2535]
> >
> > And the resulting PDF is attached...​
> > Landscape page_highlighted.pdf
> > <
> https://drive.google.com/file/d/0B_eBFHMNjkhsbElkZ3ZnVTA2eUU/view?usp=drive_web
> >
> > ​
> >
> > On Sat, Mar 26, 2016 at 9:52 PM, Maruan Sahyoun <sahyoun@fileaffairs.de>
> > wrote:
> >
> >> Hi,
> >>
> >>> Am 26.03.2016 um 21:49 schrieb Gilad Denneboom <
> >> gilad.denneboom@gmail.com>:
> >>>
> >>> Thanks a lot for your reply, Maruan.
> >>>
> >>> I'll test it out and will update here if it worked…
> >>>
> >>
> >> if not let me know - sorry again for the delay.
> >>
> >> Maruan
> >>
> >>> On Sat, Mar 26, 2016 at 8:53 PM, Maruan Sahyoun <
> sahyoun@fileaffairs.de>
> >>> wrote:
> >>>
> >>>> Hi Gilad,
> >>>>
> >>>> sorry that it took so long to answer your question.
> >>>>
> >>>> When drawing the annotation you have to think like you draw it on the
> >>>> unrotated page with your pages upper left corner being the lower left
> >>>> corner and the width and height of the annotation rect being swapped.
> >>>>
> >>>> With that the calculation of the quads is
> >>>>
> >>>>               float[] quads = new float[8];
> >>>>               quads[0] = position.getLowerLeftX();
> >>>>               quads[1] = position.getLowerLeftY();
> >>>>               quads[2] = quads[0];
> >>>>               quads[3] = position.getUpperRightY();
> >>>>               quads[4] = position.getUpperRightX();
> >>>>               quads[5] = quads[1];
> >>>>               quads[6] = quads[4];
> >>>>               quads[7] = quads[3];
> >>>>
> >>>> Hope that helps.
> >>>>
> >>>> BR
> >>>> Maruan
> >>>>
> >>>>
> >>>>> Am 14.03.2016 um 09:58 schrieb Gilad Denneboom <
> >>>> gilad.denneboom@gmail.com>:
> >>>>>
> >>>>> Any luck?
> >>>>>
> >>>>> On Mon, Mar 7, 2016 at 10:13 AM, Maruan Sahyoun <
> >> sahyoun@fileaffairs.de>
> >>>>> wrote:
> >>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> I'll take a look later today
> >>>>>>
> >>>>>> Maruan Sahyoun
> >>>>>>
> >>>>>>> Am 07.03.2016 um 09:50 schrieb Gilad Denneboom <
> >>>>>> gilad.denneboom@gmail.com>:
> >>>>>>>
> >>>>>>> Does that help anyone find a solution for this issue? I
think it
> >> could
> >>>> be
> >>>>>>> useful for more operations within PDFBox, relating to rotated
> pages.
> >>>>>>>
> >>>>>>> On Tue, Mar 1, 2016 at 2:17 PM, Gilad Denneboom <
> >>>>>> gilad.denneboom@gmail.com>
> >>>>>>> wrote:
> >>>>>>>
> >>>>>>>> OK, here's a file that demonstrates the issue. I'm attaching
the
> >>>>>> original
> >>>>>>>> as well as the version highlighted using PDFBox and
the one I
> >>>>>> highlighted
> >>>>>>>> manually in Acrobat, for comparison purposes.
> >>>>>>>>
> >>>>>>>> The details of the highlight added in PDFBox are:
> >>>>>>>> Rect:[104.73436,751.22327,147.8024,757.2535]
> >>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> Quads:[104.73436,755.2535,147.8024,755.2535,104.73436,749.22327,147.8024,749.22327]
> >>>>>>>>
> >>>>>>>> I hope this is sufficient... If not, please let me know.
> >>>>>>>> ​
> >>>>>>>> Landscape page_highlighted in Acrobat.pdf
> >>>>>>>> <
> >>>>>>
> >>>>
> >>
> https://drive.google.com/file/d/0B_eBFHMNjkhsRWdYZEdFbFBPYVU/view?usp=drive_web
> >>>>>>>
> >>>>>>>> ​​
> >>>>>>>> Landscape page.pdf
> >>>>>>>> <
> >>>>>>
> >>>>
> >>
> https://drive.google.com/file/d/0B_eBFHMNjkhsLXd5T1RKUVl4M00/view?usp=drive_web
> >>>>>>>
> >>>>>>>> ​​
> >>>>>>>> Landscape page_highlighted.pdf
> >>>>>>>> <
> >>>>>>
> >>>>
> >>
> https://drive.google.com/file/d/0B_eBFHMNjkhsQm1MZ01TTlZSSU0/view?usp=drive_web
> >>>>>>>
> >>>>>>>> ​
> >>>>>>>>
> >>>>>>>> On Wed, Feb 24, 2016 at 2:30 PM, Gilad Denneboom <
> >>>>>>>> gilad.denneboom@gmail.com> wrote:
> >>>>>>>>
> >>>>>>>>> It's a highlight.
> >>>>>>>>>
> >>>>>>>>> Let me give you the background. I'm using a variation
on
> >>>>>>>>> PrintTextLocation to find the locations I want to
highlight and
> >> then
> >>>>>> add
> >>>>>>>>> them. As I wrote, it works very well in pages with
zero rotation,
> >> but
> >>>>>> the
> >>>>>>>>> results are skewed when the pages are rotated.
> >>>>>>>>> What I mean by skewed is that they appear on the
location of the
> >> page
> >>>>>>>>> where the text would have have been had it not been
rotated, if
> >> that
> >>>>>> makes
> >>>>>>>>> sense.
> >>>>>>>>> I'll try to set up a simple example that demonstrates
this issue
> >> and
> >>>>>>>>> share it.
> >>>>>>>>>
> >>>>>>>>> On Wed, Feb 24, 2016 at 1:34 PM, Maruan Sahyoun
<
> >>>>>> sahyoun@fileaffairs.de>
> >>>>>>>>> wrote:
> >>>>>>>>>
> >>>>>>>>>> Hi,
> >>>>>>>>>>
> >>>>>>>>>> what type of annotation are you trying to put
on the page. I
> could
> >>>>>>>>>> create a little sample placing an annotation
at the (visual)
> upper
> >>>>>> left
> >>>>>>>>>> corner of a portrait and landscape page.
> >>>>>>>>>>
> >>>>>>>>>> BR
> >>>>>>>>>> Maruan
> >>>>>>>>>>
> >>>>>>>>>>> Am 24.02.2016 um 09:34 schrieb Gilad Denneboom
<
> >>>>>>>>>> gilad.denneboom@gmail.com>:
> >>>>>>>>>>>
> >>>>>>>>>>> No one has any ideas? ...
> >>>>>>>>>>>
> >>>>>>>>>>> On Sun, Feb 21, 2016 at 12:30 AM, Gilad
Denneboom <
> >>>>>>>>>> gilad.denneboom@gmail.com
> >>>>>>>>>>>> wrote:
> >>>>>>>>>>>
> >>>>>>>>>>>> Hi all,
> >>>>>>>>>>>>
> >>>>>>>>>>>> Hoping someone can help me with this
issue...
> >>>>>>>>>>>> I have a tool that adds new highlight
annotations to a page.
> It
> >>>>>> works
> >>>>>>>>>> very
> >>>>>>>>>>>> well, except for when the page is rotated.
I know I need to
> >> apply
> >>>> a
> >>>>>>>>>>>> transformation to my rect and/or quads
to get them to match
> the
> >>>>>>>>>> rotated
> >>>>>>>>>>>> user space, but I just can't get it
to work.
> >>>>>>>>>>>> Is there a utility in PDFBox (I'm using
1.8.11 at the moment)
> >> that
> >>>>>> can
> >>>>>>>>>>>> help me perform this transformation
so I can place my
> >> annotations
> >>>> at
> >>>>>>>>>> the
> >>>>>>>>>>>> right location on these pages?
> >>>>>>>>>>>>
> >>>>>>>>>>>> Thanks a lot in advance for any helpful
tips...
> >>>>>>>>>>>>
> >>>>>>>>>>>> Gilad
> >>>>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>> ---------------------------------------------------------------------
> >>>>>>>>>> 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
> >>>>>>
> >>>>>>
> >>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> 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
> >>
> >>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message