You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Sushant <su...@fitwell.in> on 2017/05/01 06:03:53 UTC

Is it possible to rotate annotation by certain angle ?

Hi ,

Is it possible to rotate annotation present in pdf using pdfbox ? which 
Class has this rotation capability ?

Thanks,

Sushant




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


Re: Is it possible to rotate annotation by certain angle ?

Posted by Sushant <su...@fitwell.in>.

On 01-05-2017 17:37, Tilman Hausherr wrote:
> Am 01.05.2017 um 14:05 schrieb Sushant:
>>
>>
>> On 01-05-2017 17:30, Tilman Hausherr wrote:
>>> Am 01.05.2017 um 13:55 schrieb Sushant:
>>>>
>>>> On 01-05-2017 16:54, Tilman Hausherr wrote:
>>>>> Am 01.05.2017 um 13:04 schrieb Sushant:
>>>>>> Thanks Tilman for quick response.
>>>>>>
>>>>>> So it means that if the noRotate flag is set to false, annotation 
>>>>>> will also rotate if page is rotated ?
>>>>>>
>>>>>> I tried this, I added a external stamp on a pdf using Adobe 
>>>>>> Acrobat Reader DC, In my code i set the annotation flag 
>>>>>> setNoRoate to false(By default also it was false), rotated the 
>>>>>> page with pdfbox with 90  but the annotation didn't rotate.
>>>>>
>>>>> It depends what rotation. What you describe is relevant to page 
>>>>> rotations, not rotations in the content stream.
>>>> Sushant : yes it is relevant to page rotations only as content 
>>>> stream doesn't do anything with annotation. I tried with page 
>>>> rotation only.
>>>>>
>>>>> Also, when reading the specification earlier today, I saw this:
>>>>>
>>>>> "Text annotations shall not scale and rotate with the page; they 
>>>>> shall behave as if the NoZoom and NoRotate annotation flags (see 
>>>>> Table 165) were always set."
>>>>>
>>>> Sushant : I also saw this, but one thing is always making me wonder 
>>>> that how the annotation is getting rotated when i rotate with 
>>>> AdobeAcrobatReader Dc and also with PDFRotator tool.
>>>
>>> That is something completely different, this is rendering (where 
>>> rendering annotations is not fully implented). Maybe clarify whether 
>>> your question is about creating a PDF or about rendering a PDF with 
>>> PDFBox.
>> It is about rendering a PDF with PDFBox , I  am doing manipulation 
>> with existing pdf.
>
> In that case, all you can do is to rotate a PDPage object, and decide 
> whether or not you want to  also rotate the annotation with the 
> norotate flag.
>
I also thought the same, Rotated PDPage , and decided to rotate the 
annotation by setting the noRotate flag to false, so that it rotates 
annotation, but it doesn't work.
This was my problem i sent initially.
For now as a solution I have rendered it as Image instead of working 
with Form  as following:


// Create a Form XObject from the source document using
                 // LayerUtility
                 LayerUtility layerUtility = new LayerUtility(doc);
                 form = layerUtility.importPageAsForm(sourceDoc,
                         sourcePageNo);

// Rendering an image from the PDF document
BufferedImage image = renderer.renderImageWithDPI(sourcePageNo, 300);

PDImageXObject pdImage = LosslessFactory.createFromImage(doc, image);

> 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: Is it possible to rotate annotation by certain angle ?

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 01.05.2017 um 14:05 schrieb Sushant:
>
>
> On 01-05-2017 17:30, Tilman Hausherr wrote:
>> Am 01.05.2017 um 13:55 schrieb Sushant:
>>>
>>> On 01-05-2017 16:54, Tilman Hausherr wrote:
>>>> Am 01.05.2017 um 13:04 schrieb Sushant:
>>>>> Thanks Tilman for quick response.
>>>>>
>>>>> So it means that if the noRotate flag is set to false, annotation 
>>>>> will also rotate if page is rotated ?
>>>>>
>>>>> I tried this, I added a external stamp on a pdf using Adobe 
>>>>> Acrobat Reader DC, In my code i set the annotation flag setNoRoate 
>>>>> to false(By default also it was false), rotated the page with 
>>>>> pdfbox with 90  but the annotation didn't rotate.
>>>>
>>>> It depends what rotation. What you describe is relevant to page 
>>>> rotations, not rotations in the content stream.
>>> Sushant : yes it is relevant to page rotations only as content 
>>> stream doesn't do anything with annotation. I tried with page 
>>> rotation only.
>>>>
>>>> Also, when reading the specification earlier today, I saw this:
>>>>
>>>> "Text annotations shall not scale and rotate with the page; they 
>>>> shall behave as if the NoZoom and NoRotate annotation flags (see 
>>>> Table 165) were always set."
>>>>
>>> Sushant : I also saw this, but one thing is always making me wonder 
>>> that how the annotation is getting rotated when i rotate with 
>>> AdobeAcrobatReader Dc and also with PDFRotator tool.
>>
>> That is something completely different, this is rendering (where 
>> rendering annotations is not fully implented). Maybe clarify whether 
>> your question is about creating a PDF or about rendering a PDF with 
>> PDFBox.
> It is about rendering a PDF with PDFBox , I  am doing manipulation 
> with existing pdf.

In that case, all you can do is to rotate a PDPage object, and decide 
whether or not you want to  also rotate the annotation with the norotate 
flag.

Tilman



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


Re: Is it possible to rotate annotation by certain angle ?

Posted by Sushant <su...@fitwell.in>.

On 01-05-2017 17:30, Tilman Hausherr wrote:
> Am 01.05.2017 um 13:55 schrieb Sushant:
>>
>> On 01-05-2017 16:54, Tilman Hausherr wrote:
>>> Am 01.05.2017 um 13:04 schrieb Sushant:
>>>> Thanks Tilman for quick response.
>>>>
>>>> So it means that if the noRotate flag is set to false, annotation 
>>>> will also rotate if page is rotated ?
>>>>
>>>> I tried this, I added a external stamp on a pdf using Adobe Acrobat 
>>>> Reader DC, In my code i set the annotation flag setNoRoate to 
>>>> false(By default also it was false), rotated the page with pdfbox 
>>>> with 90  but the annotation didn't rotate.
>>>
>>> It depends what rotation. What you describe is relevant to page 
>>> rotations, not rotations in the content stream.
>> Sushant : yes it is relevant to page rotations only as content stream 
>> doesn't do anything with annotation. I tried with page rotation only.
>>>
>>> Also, when reading the specification earlier today, I saw this:
>>>
>>> "Text annotations shall not scale and rotate with the page; they 
>>> shall behave as if the NoZoom and NoRotate annotation flags (see 
>>> Table 165) were always set."
>>>
>> Sushant : I also saw this, but one thing is always making me wonder 
>> that how the annotation is getting rotated when i rotate with 
>> AdobeAcrobatReader Dc and also with PDFRotator tool.
>
> That is something completely different, this is rendering (where 
> rendering annotations is not fully implented). Maybe clarify whether 
> your question is about creating a PDF or about rendering a PDF with 
> PDFBox.
It is about rendering a PDF with PDFBox , I  am doing manipulation with 
existing pdf.
Thanks for you reply and help.

>
> 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: Is it possible to rotate annotation by certain angle ?

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 01.05.2017 um 13:55 schrieb Sushant:
>
> On 01-05-2017 16:54, Tilman Hausherr wrote:
>> Am 01.05.2017 um 13:04 schrieb Sushant:
>>> Thanks Tilman for quick response.
>>>
>>> So it means that if the noRotate flag is set to false, annotation 
>>> will also rotate if page is rotated ?
>>>
>>> I tried this, I added a external stamp on a pdf using Adobe Acrobat 
>>> Reader DC, In my code i set the annotation flag setNoRoate to 
>>> false(By default also it was false), rotated the page with pdfbox 
>>> with 90  but the annotation didn't rotate.
>>
>> It depends what rotation. What you describe is relevant to page 
>> rotations, not rotations in the content stream.
> Sushant : yes it is relevant to page rotations only as content stream 
> doesn't do anything with annotation. I tried with page rotation only.
>>
>> Also, when reading the specification earlier today, I saw this:
>>
>> "Text annotations shall not scale and rotate with the page; they 
>> shall behave as if the NoZoom and NoRotate annotation flags (see 
>> Table 165) were always set."
>>
> Sushant : I also saw this, but one thing is always making me wonder 
> that how the annotation is getting rotated when i rotate with 
> AdobeAcrobatReader Dc and also with PDFRotator tool.

That is something completely different, this is rendering (where 
rendering annotations is not fully implented). Maybe clarify whether 
your question is about creating a PDF or about rendering a PDF with PDFBox.

Tilman


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


Re: Is it possible to rotate annotation by certain angle ?

Posted by Sushant <su...@fitwell.in>.
On 01-05-2017 16:54, Tilman Hausherr wrote:
> Am 01.05.2017 um 13:04 schrieb Sushant:
>> Thanks Tilman for quick response.
>>
>> So it means that if the noRotate flag is set to false, annotation 
>> will also rotate if page is rotated ?
>>
>> I tried this, I added a external stamp on a pdf using Adobe Acrobat 
>> Reader DC, In my code i set the annotation flag setNoRoate to 
>> false(By default also it was false), rotated the page with pdfbox 
>> with 90  but the annotation didn't rotate.
>
> It depends what rotation. What you describe is relevant to page 
> rotations, not rotations in the content stream.
Sushant : yes it is relevant to page rotations only as content stream 
doesn't do anything with annotation. I tried with page rotation only.
>
> Also, when reading the specification earlier today, I saw this:
>
> "Text annotations shall not scale and rotate with the page; they shall 
> behave as if the NoZoom and NoRotate annotation flags (see Table 165) 
> were always set."
>
Sushant : I also saw this, but one thing is always making me wonder that 
how the annotation is getting rotated when i rotate with 
AdobeAcrobatReader Dc and also with PDFRotator tool.
> Tilman
>
>>
>> Thanks,
>>
>> Sushant
>>
>>
>>
>> On 01-05-2017 13:08, Tilman Hausherr wrote:
>>> Am 01.05.2017 um 08:03 schrieb Sushant:
>>>> Hi ,
>>>>
>>>> Is it possible to rotate annotation present in pdf using pdfbox ?
>>>
>>> No. The only thing there is is the NoRotate flag which means the 
>>> annotation will stay unrotated if the page is rotated by a multiple 
>>> of 90�.
>>>
>>> http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf 
>>>
>>>
>>> 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
>
>


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


Re: Is it possible to rotate annotation by certain angle ?

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 01.05.2017 um 13:04 schrieb Sushant:
> Thanks Tilman for quick response.
>
> So it means that if the noRotate flag is set to false, annotation will 
> also rotate if page is rotated ?
>
> I tried this, I added a external stamp on a pdf using Adobe Acrobat 
> Reader DC, In my code i set the annotation flag setNoRoate to false(By 
> default also it was false), rotated the page with pdfbox with 90  but 
> the annotation didn't rotate.

It depends what rotation. What you describe is relevant to page 
rotations, not rotations in the content stream.

Also, when reading the specification earlier today, I saw this:

"Text annotations shall not scale and rotate with the page; they shall 
behave as if the NoZoom and NoRotate annotation flags (see Table 165) 
were always set."

Tilman

>
> Thanks,
>
> Sushant
>
>
>
> On 01-05-2017 13:08, Tilman Hausherr wrote:
>> Am 01.05.2017 um 08:03 schrieb Sushant:
>>> Hi ,
>>>
>>> Is it possible to rotate annotation present in pdf using pdfbox ?
>>
>> No. The only thing there is is the NoRotate flag which means the 
>> annotation will stay unrotated if the page is rotated by a multiple 
>> of 90�.
>>
>> http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf 
>>
>>
>> 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: Is it possible to rotate annotation by certain angle ?

Posted by Sushant <su...@fitwell.in>.
Thanks Tilman for quick response.

So it means that if the noRotate flag is set to false, annotation will 
also rotate if page is rotated ?

I tried this, I added a external stamp on a pdf using Adobe Acrobat 
Reader DC, In my code i set the annotation flag setNoRoate to false(By 
default also it was false), rotated the page with pdfbox with 90  but 
the annotation didn't rotate.

Thanks,

Sushant



On 01-05-2017 13:08, Tilman Hausherr wrote:
> Am 01.05.2017 um 08:03 schrieb Sushant:
>> Hi ,
>>
>> Is it possible to rotate annotation present in pdf using pdfbox ?
>
> No. The only thing there is is the NoRotate flag which means the 
> annotation will stay unrotated if the page is rotated by a multiple of 
> 90�.
>
> http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf 
>
>
> 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: Is it possible to rotate annotation by certain angle ?

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 01.05.2017 um 08:03 schrieb Sushant:
> Hi ,
>
> Is it possible to rotate annotation present in pdf using pdfbox ?

No. The only thing there is is the NoRotate flag which means the 
annotation will stay unrotated if the page is rotated by a multiple of 90�.

http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf

Tilman

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