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 rectangle annotation to a PDF on iOS

To add a rectangle annotation to a PDF Document page.

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

// Create a rectangle
PTSquare *sq = [PTSquare Create: [doc GetSDFDoc] pos: [[PTPDFRect alloc] initWithX1: 500 y1: 200 x2: 580 y2: 300]];
[sq SetColor: [[PTColorPt alloc] initWithX: 1 y: 0 z: 0 w: 0] numcomp: 3];
[sq SetInteriorColor: [[PTColorPt alloc] initWithX: 0 y: 1 z: 1 w: 0] CompNum: 3];
NSMutableArray *dash = [NSMutableArray arrayWithCapacity: 2];
[dash addObject: @4.0];
[dash addObject: @2.0];
[sq SetBorderStyle: [[PTBorderStyle alloc] initWithS: e_ptdashed b_width: 6 b_hr: 0 b_vr: 0 b_dash: dash] oldStyleOnly: NO];
[sq SetPadding: 4];
[sq RefreshAppearance];
[page AnnotPushBack: sq];

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, rectangle, squiggly, caret, and ink).

Get the answers you need: Chat with us