Annotation overview
Foxit PDF SDK for iOS supports most PDF annotation types via Core SDK for create, property access, appearance generation, and rendering.
UI Extensions built-in annotations
With the full reader (UI Extensions), common annotations (highlight, note, drawing, stamp, etc.) are available from the toolbar. This guide focuses on programmatic control.
Annotation types
PDF annotation types, Markup classification, and SDK support:
| Type | Constant | Description | Markup | SDK support |
|---|---|---|---|---|
| Text (Note) | FSAnnotNote | Note / text comment | Yes | Supported |
| Link | FSAnnotLink | Hyperlink | No | Supported |
| FreeText | FSAnnotFreeText | Free text (typewriter / text box / callout) | Yes | Supported |
| Line | FSAnnotLine | Line / arrow | Yes | Supported |
| Square | FSAnnotSquare | Rectangle | Yes | Supported |
| Circle | FSAnnotCircle | Circle / ellipse | Yes | Supported |
| Polygon | FSAnnotPolygon | Polygon | Yes | Supported |
| PolyLine | FSAnnotPolyLine | Polyline | Yes | Supported |
| Highlight | FSAnnotHighlight | Text highlight | Yes | Supported |
| Underline | FSAnnotUnderline | Underline | Yes | Supported |
| Squiggly | FSAnnotSquiggly | Squiggly underline | Yes | Supported |
| StrikeOut | FSAnnotStrikeOut | Strikethrough | Yes | Supported |
| Stamp | FSAnnotStamp | Stamp | Yes | Supported |
| Caret | FSAnnotCaret | Caret | Yes | Supported |
| Ink | FSAnnotInk | Freehand ink | Yes | Supported |
| Popup | FSAnnotPopup | Popup for comment text | No | Supported |
| FileAttachment | FSAnnotFileAttachment | File attachment | Yes | Supported |
| Sound | FSAnnotSound | Sound | Yes | Not supported |
| Movie | FSAnnotMovie | Movie | No | Not supported |
| Widget | FSAnnotWidget | Form widget | No | Supported |
| Screen | FSAnnotScreen | Screen / media | No | Supported |
| PrinterMark | FSAnnotPrinterMark | Printer mark | No | Not supported |
| TrapNet | FSAnnotTrapNet | Trap net | No | Not supported |
| Watermark | FSAnnotWatermark | Watermark annotation | No | Not supported |
| 3D | FSAnnot3D | 3D | No | Not supported |
| Redact | FSAnnotRedact | Redaction | Yes | Supported |
INFO
The SDK also supports custom type PSI (Pressure Sensitive Ink, FSAnnotPSInk), not defined in the PDF spec—typically for handwriting.
The PDF Watermark annotation type is not supported; page-content watermarks are supported. See Watermarks.
Class hierarchy
FSAnnot ← Base class
├── FSMarkup ← Markup base (title, subject, opacity, replies, grouping, etc.)
│ ├── FSTextMarkup ← Text markup (Highlight / Underline / StrikeOut / Squiggly)
│ ├── FSFreeText ← Free text
│ ├── FSNote ← Note
│ ├── FSLine ← Line
│ ├── FSSquare ← Square
│ ├── FSCircle ← Circle
│ ├── FSInk ← Ink
│ ├── FSStamp ← Stamp
│ ├── FSCaret ← Caret
│ ├── FSFileAttachment ← File attachment
│ └── FSRedact ← Redaction
├── FSLink ← Link
├── FSScreen ← Screen
├── FSWidget ← Widget
└── FSPopup ← PopupFSAnnot — common properties
| Method | Description |
|---|---|
getType | Annotation type (FSAnnotType) |
getPage | Page |
getRect / setRect: | Bounding rect |
move: | Move |
getContent / setContent: | Text content |
getBorderColor / setBorderColor: | Border color |
getBorderInfo / setBorderInfo: | Border (width, style, dash) |
getFlags / setFlags: | Flags (hidden, locked, etc.) |
getUniqueID / setUniqueID: | Unique ID |
getModifiedDateTime / setModifiedDateTime: | Modified time |
resetAppearanceStream | Regenerate appearance (required after property changes) |
isEmpty | Empty check |
Important
After changing properties, call resetAppearanceStream so appearance updates apply.
FSMarkup — extended properties
| Method | Description |
|---|---|
getTitle / setTitle: | Author / title |
getSubject / setSubject: | Subject |
getOpacity / setOpacity: | Opacity (0.0–1.0) |
getIntent / setIntent: | Intent (e.g. FreeText subtypes) |
getCreationDateTime / setCreationDateTime: | Creation time |
getPopup / setPopup: | Associated popup |
getReplyCount | Reply count |
getReply: / addReply / removeReply: | Replies (FSNote) |
removeAllReplies | Remove all replies |
isGrouped | In a group |
getGroupHeader / getGroupElements / ungroup | Grouping |
getStateAnnots: / addStateAnnot:stateModel:state: | Review / mark states |
Create annotations
Use [FSPDFPage addAnnot:rect:]:
objc
#import <FoxitRDK/FSPDFObjC.h>
FSPDFDoc *doc = [[FSPDFDoc alloc] initWithPath:@"path/to/Sample.pdf"];
[doc load:nil];
FSPDFPage *page = [doc getPage:0];
FSRectF *rect = [[FSRectF alloc] initWithLeft1:100 bottom1:100 right1:130 top1:130];
FSAnnot *annot = [page addAnnot:FSAnnotNote rect:rect];
FSNote *note = [[FSNote alloc] initWithAnnot:annot];
[note setIconName:@"Comment"];
[note setBorderColor:0xFF0000FF];
[note setContent:@"This is a note annotation."];
[note resetAppearanceStream];
[doc saveAs:@"path/to/output.pdf" saveFlags:FSPDFDocSaveFlagNormal];Remove annotations
objc
FSAnnot *annot = [page getAnnot:0];
if (annot && ![annot isEmpty]) {
[page removeAnnot:annot];
}Annotation events
Register IAnnotEventListener on UIExtensionsManager:
objc
[extensionsManager registerAnnotEventListener:self];
// IAnnotEventListener
- (void)onAnnotAdded:(FSPDFPage *)page annot:(FSAnnot *)annot {
NSLog(@"Annotation added: %@", [annot getContent]);
}
- (void)onAnnotDeleted:(FSPDFPage *)page annot:(FSAnnot *)annot {
NSLog(@"Annotation deleted");
}
- (void)onAnnotModified:(FSPDFPage *)page annot:(FSAnnot *)annot {
NSLog(@"Annotation modified");
}Note
Unregister with unregisterAnnotEventListener: when the view controller is torn down to avoid leaks.
More annotation topics
- Text markup — Highlight, underline, strikethrough, squiggly
- Notes and free text — Note, typewriter, text box, callout, caret
- Shapes and drawing — Line, square, circle, polygon, polyline, ink
- Stamps — Standard and custom stamps
- Links — URI and in-document links
- Redaction — Create and apply redactions
- Import and export — FDF/XFDF, flatten
API reference
See the API reference for FSAnnot, FSMarkup, FSNote, FSLine, FSTextMarkup, and related classes.