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

Skip to first unread message


Apr 8, 2014, 3:20:41 PM4/8/14

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.



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:

See the ElementBuilderTest example for more on how to create appearance/content streams, including how to set the transformation matrix (to rotate):

Reply all
Reply to author
0 new messages