How do I rotate a PDF annotation by an arbitrary angle?

301 views
Skip to first unread message

Support

unread,
Apr 8, 2014, 3:20:41 PM4/8/14
to pdfne...@googlegroups.com
Q:

I want to rotate an annotation while drawing it on a rotated page in an Android application. We have created a transformation matrix (Matrix2D) from the page rotation. But confused how to apply the same in Annotation. A help is much appreciated.


-----------

A:


Unfortunately, there is no easy way to rotate annotations (e.g. by an arbitrary angle) according the PDF standard. Annotations themselves have no rotation, instead they are always rotated with the page rotation, or with the e_no_rotate_flag, not rotated when the page rotation. This is typically used with annotations like a post-it note style, so no matter which way the user rotates the page, including while viewing it in a PDF reader, it is always orientated one way.

So, if you want to explicitly control rotation, you actually need to create your own content stream (search for SetApprarance() in this forum), and surround it with a transformation matrix, and then apply it to the annotation.

Here is a forum post describing this:  https://groups.google.com/d/msg/pdfnet-sdk/t1e9hODFa9Y/TF2zUwuEWMcJ

See the ElementBuilderTest example for more on how to create appearance/content streams, including how to set the transformation matrix (to rotate): http://www.pdftron.com/pdfnet/samplecode.html#ElementBuilder



Reply all
Reply to author
Forward
0 new messages