Add a free text annotation to a PDF on Server/Desktop

To add a free text annotation to a PDF Document page.

1doc = PDFDoc(filename)
2page = doc.GetPage(1)
3
4# Create a free text
5txtannot = FreeText.Create( doc.GetSDFDoc(), Rect(100, 100, 350, 500) )
6txtannot.SetContentRect( Rect( 200, 200, 350, 500 ) )
7txtannot.SetContents( "\n\nSome swift brown fox snatched a gray hare out of the air "
8 "by freezing it with an angry glare."
9 "\n\nAha!\n\nAnd there was much rejoicing!" )
10txtannot.SetCalloutLinePoints( Point(200,300), Point(150,290), Point(110,110) )
11txtannot.SetBorderStyle( BorderStyle( BorderStyle.e_solid, 1, 10, 20 ), True )
12txtannot.SetEndingStyle( LineAnnot.e_ClosedArrow )
13txtannot.SetColor( ColorPt( 0, 1, 0 ) )
14txtannot.SetQuaddingFormat(1)
15page.AnnotPushBack(txtannot)
16txtannot.RefreshAppearance()

Add or edit PDF annotations sample
Full code sample which shows how to add or edit PDF annotations (e.g. hyperlink, intra-document link, stamp, rubber stamp, file attachment, sound, text, free-text, line, circle, square, polygon, polyline, free text, squiggly, caret, and ink).

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales