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/06 06:02:43 UTC
pdf with vertical mediabox but landscape rotation
hi. i have created annotations in the pdf but i encountered 1 weird pdf
wherein it is displayed as horizontal but the mediabox is 729x1224 which is
vertical and the PDPage.getRottation() has a value of 270
which explains why it is displayed horizontally (landscape).
my problem is when i add annotations, i have a function that calculates the
new coordinates based on the PDPage bounding box since the source of the
coordinates is via web.
what happens is the annotations get misplaced. i tried to switch width and
height so it would be landscaped but this did not work out. i figure there
needs to be some way to probably rotate it virtually so as to correctly
position the annotations?
anyone got ideas perhaps?
Re: pdf with vertical mediabox but landscape rotation
Posted by chitgoks <ch...@gmail.com>.
i think ill do away with the norotate flag then
it is a pain though doing your own rendering lol. but it looks to be the
only way
On Sun, Jan 7, 2018 at 6:30 PM, Tilman Hausherr <TH...@t-online.de>
wrote:
> Am 07.01.2018 um 11:17 schrieb chitgoks:
>
>> hi tilman ok
>>
>> i dont understand what the norotate flag is for
>>
>
> See in the PDF specification: "If set, do not rotate the annotation’s
> appearance to match the rotation of the page. The upper-left corner of the
> annotation rectangle shall remain in a fixed location on the page,
> regardless of the page rotation. See further discussion following this
> Table."
>
> If you do your own rendering you need to do the transformations (rotation
> + appropriate translation, because a "pure" rotation is around a corner and
> not around the middle) similar to PDFRenderer.java before displaying the
> annotations. Unless the flag is set. (Which is a problem for PDFBox,
> because we always have the transformations already active when rendering
> annotations, so one would have to temporarly "undo" these when rendering
> "NoRotate" annotations)
>
> Tilman
>
>
>
>
>> so far, i have managed to fix square, circle and stamps and currently
>> working on fixing free text's appearance.
>>
>> i think my biggest hurdle is the point based annotations like line,
>> arrows,
>> polygons because they seem to be rendered opposite
>>
>> On Sun, Jan 7, 2018 at 6:11 PM, Tilman Hausherr <TH...@t-online.de>
>> wrote:
>>
>> Hi,
>>> "Adding" is always supported but as you know PDFBox doesn't offer much
>>> high level help with creating PDFs. Rendering is also correct, unless the
>>> NoRotate flag is set. For an example, see this issue:
>>> https://github.com/mozilla/pdf.js/issues/7631
>>>
>>> Tilman
>>>
>>> Am 07.01.2018 um 03:11 schrieb chitgoks:
>>>
>>> hi tilman
>>>>
>>>> does this means adding annotations in landscape is not supported yet?
>>>>
>>>> thanks
>>>>
>>>> On Sat, Jan 6, 2018 at 7:35 PM, Tilman Hausherr <TH...@t-online.de>
>>>> wrote:
>>>>
>>>> Am 06.01.2018 um 11:19 schrieb chitgoks:
>>>>
>>>>> regarding my previous email on landscape
>>>>>
>>>>>> it looks like portrait or landscape have same bbox but for landscape
>>>>>> there
>>>>>> is a rotation value
>>>>>>
>>>>>> does pdfbox have some sort of convenience method to get bbox (like in
>>>>>> itext
>>>>>> page.getPageSizeWithRotation()) based on rotation? or how to do this
>>>>>> manually in pdfbox?
>>>>>>
>>>>>>
>>>>>> You'll have to do it by hand, see in PDFRenderer how the page is
>>>>>>
>>>>> prepared.
>>>>>
>>>>> If you support the "NoRotate" flag (which PDFBox does not support yet
>>>>> in
>>>>> rendering annotations) then it is more tricky.
>>>>>
>>>>> Tilman
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>
>
Re: pdf with vertical mediabox but landscape rotation
Posted by Tilman Hausherr <TH...@t-online.de>.
Am 07.01.2018 um 11:17 schrieb chitgoks:
> hi tilman ok
>
> i dont understand what the norotate flag is for
See in the PDF specification: "If set, do not rotate the annotation’s
appearance to match the rotation of the page. The upper-left corner of
the annotation rectangle shall remain in a fixed location on the page,
regardless of the page rotation. See further discussion following this
Table."
If you do your own rendering you need to do the transformations
(rotation + appropriate translation, because a "pure" rotation is around
a corner and not around the middle) similar to PDFRenderer.java before
displaying the annotations. Unless the flag is set. (Which is a problem
for PDFBox, because we always have the transformations already active
when rendering annotations, so one would have to temporarly "undo" these
when rendering "NoRotate" annotations)
Tilman
>
> so far, i have managed to fix square, circle and stamps and currently
> working on fixing free text's appearance.
>
> i think my biggest hurdle is the point based annotations like line, arrows,
> polygons because they seem to be rendered opposite
>
> On Sun, Jan 7, 2018 at 6:11 PM, Tilman Hausherr <TH...@t-online.de>
> wrote:
>
>> Hi,
>> "Adding" is always supported but as you know PDFBox doesn't offer much
>> high level help with creating PDFs. Rendering is also correct, unless the
>> NoRotate flag is set. For an example, see this issue:
>> https://github.com/mozilla/pdf.js/issues/7631
>>
>> Tilman
>>
>> Am 07.01.2018 um 03:11 schrieb chitgoks:
>>
>>> hi tilman
>>>
>>> does this means adding annotations in landscape is not supported yet?
>>>
>>> thanks
>>>
>>> On Sat, Jan 6, 2018 at 7:35 PM, Tilman Hausherr <TH...@t-online.de>
>>> wrote:
>>>
>>> Am 06.01.2018 um 11:19 schrieb chitgoks:
>>>> regarding my previous email on landscape
>>>>> it looks like portrait or landscape have same bbox but for landscape
>>>>> there
>>>>> is a rotation value
>>>>>
>>>>> does pdfbox have some sort of convenience method to get bbox (like in
>>>>> itext
>>>>> page.getPageSizeWithRotation()) based on rotation? or how to do this
>>>>> manually in pdfbox?
>>>>>
>>>>>
>>>>> You'll have to do it by hand, see in PDFRenderer how the page is
>>>> prepared.
>>>>
>>>> If you support the "NoRotate" flag (which PDFBox does not support yet in
>>>> rendering annotations) then it is more tricky.
>>>>
>>>> Tilman
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
Re: pdf with vertical mediabox but landscape rotation
Posted by chitgoks <ch...@gmail.com>.
hi tilman ok
i dont understand what the norotate flag is for
so far, i have managed to fix square, circle and stamps and currently
working on fixing free text's appearance.
i think my biggest hurdle is the point based annotations like line, arrows,
polygons because they seem to be rendered opposite
On Sun, Jan 7, 2018 at 6:11 PM, Tilman Hausherr <TH...@t-online.de>
wrote:
> Hi,
> "Adding" is always supported but as you know PDFBox doesn't offer much
> high level help with creating PDFs. Rendering is also correct, unless the
> NoRotate flag is set. For an example, see this issue:
> https://github.com/mozilla/pdf.js/issues/7631
>
> Tilman
>
> Am 07.01.2018 um 03:11 schrieb chitgoks:
>
>> hi tilman
>>
>> does this means adding annotations in landscape is not supported yet?
>>
>> thanks
>>
>> On Sat, Jan 6, 2018 at 7:35 PM, Tilman Hausherr <TH...@t-online.de>
>> wrote:
>>
>> Am 06.01.2018 um 11:19 schrieb chitgoks:
>>>
>>> regarding my previous email on landscape
>>>>
>>>> it looks like portrait or landscape have same bbox but for landscape
>>>> there
>>>> is a rotation value
>>>>
>>>> does pdfbox have some sort of convenience method to get bbox (like in
>>>> itext
>>>> page.getPageSizeWithRotation()) based on rotation? or how to do this
>>>> manually in pdfbox?
>>>>
>>>>
>>>> You'll have to do it by hand, see in PDFRenderer how the page is
>>> prepared.
>>>
>>> If you support the "NoRotate" flag (which PDFBox does not support yet in
>>> rendering annotations) then it is more tricky.
>>>
>>> Tilman
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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: pdf with vertical mediabox but landscape rotation
Posted by Tilman Hausherr <TH...@t-online.de>.
Hi,
"Adding" is always supported but as you know PDFBox doesn't offer much
high level help with creating PDFs. Rendering is also correct, unless
the NoRotate flag is set. For an example, see this issue:
https://github.com/mozilla/pdf.js/issues/7631
Tilman
Am 07.01.2018 um 03:11 schrieb chitgoks:
> hi tilman
>
> does this means adding annotations in landscape is not supported yet?
>
> thanks
>
> On Sat, Jan 6, 2018 at 7:35 PM, Tilman Hausherr <TH...@t-online.de>
> wrote:
>
>> Am 06.01.2018 um 11:19 schrieb chitgoks:
>>
>>> regarding my previous email on landscape
>>>
>>> it looks like portrait or landscape have same bbox but for landscape there
>>> is a rotation value
>>>
>>> does pdfbox have some sort of convenience method to get bbox (like in
>>> itext
>>> page.getPageSizeWithRotation()) based on rotation? or how to do this
>>> manually in pdfbox?
>>>
>>>
>> You'll have to do it by hand, see in PDFRenderer how the page is prepared.
>>
>> If you support the "NoRotate" flag (which PDFBox does not support yet in
>> rendering annotations) then it is more tricky.
>>
>> Tilman
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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: pdf with vertical mediabox but landscape rotation
Posted by chitgoks <ch...@gmail.com>.
hi tilman
does this means adding annotations in landscape is not supported yet?
thanks
On Sat, Jan 6, 2018 at 7:35 PM, Tilman Hausherr <TH...@t-online.de>
wrote:
> Am 06.01.2018 um 11:19 schrieb chitgoks:
>
>> regarding my previous email on landscape
>>
>> it looks like portrait or landscape have same bbox but for landscape there
>> is a rotation value
>>
>> does pdfbox have some sort of convenience method to get bbox (like in
>> itext
>> page.getPageSizeWithRotation()) based on rotation? or how to do this
>> manually in pdfbox?
>>
>>
> You'll have to do it by hand, see in PDFRenderer how the page is prepared.
>
> If you support the "NoRotate" flag (which PDFBox does not support yet in
> rendering annotations) then it is more tricky.
>
> Tilman
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>
Re: pdf with vertical mediabox but landscape rotation
Posted by Tilman Hausherr <TH...@t-online.de>.
Am 06.01.2018 um 11:19 schrieb chitgoks:
> regarding my previous email on landscape
>
> it looks like portrait or landscape have same bbox but for landscape there
> is a rotation value
>
> does pdfbox have some sort of convenience method to get bbox (like in itext
> page.getPageSizeWithRotation()) based on rotation? or how to do this
> manually in pdfbox?
>
You'll have to do it by hand, see in PDFRenderer how the page is prepared.
If you support the "NoRotate" flag (which PDFBox does not support yet in
rendering annotations) then it is more tricky.
Tilman
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org
Re: pdf with vertical mediabox but landscape rotation
Posted by chitgoks <ch...@gmail.com>.
regarding my previous email on landscape
it looks like portrait or landscape have same bbox but for landscape there
is a rotation value
does pdfbox have some sort of convenience method to get bbox (like in itext
page.getPageSizeWithRotation()) based on rotation? or how to do this
manually in pdfbox?