Some test text!

Search
Hamburger Icon

iOS / Guides

Create annotations

A variety of annotations can be created such as sticky note (text annotations), link annotations, stamp annotations, and more.

Add free text annotation to a PDF on iOS

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

PTPDFDoc *doc = [[PTPDFDoc alloc] initWithFilepath: filename];
PTPage *page = [doc GetPage:1];

// Create a free text
PTFreeText *txtannot = [PTFreeText Create: [doc GetSDFDoc] pos: [[PTPDFRect alloc] initWithX1: 100 y1: 100 x2: 350 y2: 500]];
[txtannot SetContentRect: [[PTPDFRect alloc] initWithX1: 200 y1: 200 x2: 350 y2: 500]];
[txtannot SetContents: @"\n\nSome swift brown fox snatched a gray hare out of the air by freezing it with an angry glare."
                        "\n\nAha!\n\nAnd there was much rejoicing!"];
[txtannot SetCalloutLinePointsWithKneePoint: [[PTPDFPoint alloc] initWithPx: 200 py: 300] p2: [[PTPDFPoint alloc] initWithPx: 150 py: 290] p3: [[PTPDFPoint alloc] initWithPx: 110 py: 110]];
[txtannot SetBorderStyle: [[PTBorderStyle alloc] initWithS: e_ptsolid b_width: 1 b_hr: 10 b_vr: 20 ] oldStyleOnly: YES];
[txtannot SetEndingStyle: e_ptClosedArrow];
[txtannot SetColor: [[PTColorPt alloc] initWithX: 0 y: 1 z: 0 w: 0] numcomp: 3];
[txtannot SetQuaddingFormat: 1];
[page AnnotPushBack: txtannot];
[txtannot 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).

Get the answers you need: Chat with us