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

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

1doc := NewPDFDoc(filename)
2page := doc.GetPage(1)
3
4// Create a free text
5txtannot := FreeTextCreate( doc.GetSDFDoc(), NewRect(100.0, 100.0, 350.0, 500.0) )
6txtannot.SetContentRect( NewRect(200.0, 200.0, 350.0, 500.0 ) )
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( NewPoint(200.0,300.0), NewPoint(150.0,290.0), NewPoint(110.0,110.0) )
11txtannot.SetBorderStyle( NewBorderStyle( BorderStyleE_solid, 1.0, 10.0, 20.0 ), false )
12txtannot.SetEndingStyle( LineAnnotE_ClosedArrow )
13txtannot.SetColor( NewColorPt( 0.0, 1.0, 0.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