Notes and free text
This guide covers Note, FreeText, and Caret annotations.
Note annotations
A note appears as an icon on the page; a popup shows or edits the comment text.
Core methods
| Method | Description |
|---|---|
getIconName / setIconName: | Icon name (@"Comment", @"Key", @"Note", @"Help", etc.) |
getOpenStatus / setOpenStatus: | Popup open by default |
getReplyTo | Parent annotation (for replies) |
isStateAnnot | State annotation |
getState / setState: | State (review, mark, etc.) |
getStateModel | State model type |
State constants
Marked model (FSMarkupStateModelMarked)
| Constant | Description |
|---|---|
FSMarkupStateMarked | Marked |
FSMarkupStateUnmarked | Unmarked |
Review model (FSMarkupStateModelReview)
| Constant | Description |
|---|---|
FSMarkupStateAccepted | Accepted |
FSMarkupStateRejected | Rejected |
FSMarkupStateCancelled | Cancelled |
FSMarkupStateCompleted | Completed |
FSMarkupStateDeferred | Deferred |
FSMarkupStateFuture | Future |
FSMarkupStateNone | None |
Example: create a note
objc
#import <FoxitRDK/FSPDFObjC.h>
FSPDFPage *page = [doc getPage:0];
FSRectF *rect = [[FSRectF alloc] initWithLeft1:100 bottom1:100 right1:124 top1:124];
FSAnnot *annot = [page addAnnot:FSAnnotNote rect:rect];
FSNote *note = [[FSNote alloc] initWithAnnot:annot];
[note setIconName:@"Comment"];
[note setBorderColor:0xFF0000FF];
[note setContent:@"Review comment: this paragraph needs revision."];
[note setTitle:@"Reviewer"];
[note setOpenStatus:NO];
[note resetAppearanceStream];Example: add a reply
objc
FSMarkup *markup = [[FSMarkup alloc] initWithAnnot:[page getAnnot:0]];
FSNote *reply = [markup addReply];
[reply setContent:@"Revised. Please review again."];
[reply setTitle:@"Author"];
[reply resetAppearanceStream];
int replyCount = [markup getReplyCount];FreeText annotations
FreeText renders text on the page (unlike note icons). Subtypes depend on intent:
| Subtype | Intent | Description |
|---|---|---|
| Plain | @"" | Text in a rectangle |
| Typewriter | @"FreeTextTypewriter" | Typewriter-style text |
| Callout | @"FreeTextCallout" | Callout with leader line |
Core methods
| Method | Description |
|---|---|
getAlignment / setAlignment: | Alignment (0=left, 1=center, 2=right) |
getDefaultAppearance / setDefaultAppearance: | Font, size, color |
getFillColor / setFillColor: | Fill color |
getInnerRect / setInnerRect: | Inner text rect |
getRotation / setRotation: / rotate: | Rotation |
getCalloutLinePoints / setCalloutLinePoints: | Callout line points |
getCalloutLineEndingStyle / setCalloutLineEndingStyle: | Callout line ending |
Example: typewriter
objc
#import <FoxitRDK/FSPDFObjC.h>
FSPDFPage *page = [doc getPage:0];
FSRectF *rect = [[FSRectF alloc] initWithLeft1:100 bottom1:500 right1:350 top1:540];
FSAnnot *annot = [page addAnnot:FSAnnotFreeText rect:rect];
FSFreeText *freeText = [[FSFreeText alloc] initWithAnnot:annot];
[freeText setIntent:@"FreeTextTypewriter"];
[freeText setContent:@"This text was added with a typewriter annotation."];
FSDefaultAppearance *da = [[FSDefaultAppearance alloc] init];
[da setText_size:14];
[da setText_color:0xFF000000];
[freeText setDefaultAppearance:da];
[freeText setAlignment:0];
[freeText setOpacity:1.0f];
[freeText resetAppearanceStream];Example: callout
objc
#import <FoxitRDK/FSPDFObjC.h>
FSPDFPage *page = [doc getPage:0];
FSRectF *rect = [[FSRectF alloc] initWithLeft1:200 bottom1:400 right1:400 top1:450];
FSAnnot *annot = [page addAnnot:FSAnnotFreeText rect:rect];
FSFreeText *callout = [[FSFreeText alloc] initWithAnnot:annot];
[callout setIntent:@"FreeTextCallout"];
[callout setContent:@"Please note the formatting issue here."];
FSPointFArray *points = [[FSPointFArray alloc] init];
FSPointF *pt1 = [[FSPointF alloc] init];
[pt1 set:100 y:350];
FSPointF *pt2 = [[FSPointF alloc] init];
[pt2 set:150 y:400];
FSPointF *pt3 = [[FSPointF alloc] init];
[pt3 set:200 y:420];
[points add:pt1];
[points add:pt2];
[points add:pt3];
[callout setCalloutLinePoints:points];
[callout setCalloutLineEndingStyle:FSMarkupEndingStyleOpenArrow];
[callout resetAppearanceStream];Caret annotations
Caret (FSAnnotCaret) marks insertion or replacement positions, often shown as ^.
objc
FSPDFPage *page = [doc getPage:0];
FSRectF *rect = [[FSRectF alloc] initWithLeft1:150 bottom1:700 right1:160 top1:720];
FSAnnot *caret = [page addAnnot:FSAnnotCaret rect:rect];
[caret setContent:@"Insert a new paragraph here."];
[caret setBorderColor:0xFF0000FF];
[caret resetAppearanceStream];