Skip to content

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:

TypeConstantDescriptionMarkupSDK support
Text (Note)FSAnnotNoteNote / text commentYesSupported
LinkFSAnnotLinkHyperlinkNoSupported
FreeTextFSAnnotFreeTextFree text (typewriter / text box / callout)YesSupported
LineFSAnnotLineLine / arrowYesSupported
SquareFSAnnotSquareRectangleYesSupported
CircleFSAnnotCircleCircle / ellipseYesSupported
PolygonFSAnnotPolygonPolygonYesSupported
PolyLineFSAnnotPolyLinePolylineYesSupported
HighlightFSAnnotHighlightText highlightYesSupported
UnderlineFSAnnotUnderlineUnderlineYesSupported
SquigglyFSAnnotSquigglySquiggly underlineYesSupported
StrikeOutFSAnnotStrikeOutStrikethroughYesSupported
StampFSAnnotStampStampYesSupported
CaretFSAnnotCaretCaretYesSupported
InkFSAnnotInkFreehand inkYesSupported
PopupFSAnnotPopupPopup for comment textNoSupported
FileAttachmentFSAnnotFileAttachmentFile attachmentYesSupported
SoundFSAnnotSoundSoundYesNot supported
MovieFSAnnotMovieMovieNoNot supported
WidgetFSAnnotWidgetForm widgetNoSupported
ScreenFSAnnotScreenScreen / mediaNoSupported
PrinterMarkFSAnnotPrinterMarkPrinter markNoNot supported
TrapNetFSAnnotTrapNetTrap netNoNot supported
WatermarkFSAnnotWatermarkWatermark annotationNoNot supported
3DFSAnnot3D3DNoNot supported
RedactFSAnnotRedactRedactionYesSupported

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               ← Popup

FSAnnot — common properties

MethodDescription
getTypeAnnotation type (FSAnnotType)
getPagePage
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
resetAppearanceStreamRegenerate appearance (required after property changes)
isEmptyEmpty check

Important

After changing properties, call resetAppearanceStream so appearance updates apply.

FSMarkup — extended properties

MethodDescription
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
getReplyCountReply count
getReply: / addReply / removeReply:Replies (FSNote)
removeAllRepliesRemove all replies
isGroupedIn a group
getGroupHeader / getGroupElements / ungroupGrouping
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

API reference

See the API reference for FSAnnot, FSMarkup, FSNote, FSLine, FSTextMarkup, and related classes.