Skip to content

Stamp annotations

Stamp annotations add seal-like marks on a page using PDF standard stamps or custom bitmaps/images.

Standard stamps

Set setIconName: to a standard name:

Icon nameDescription
@"Approved"Approved
@"AsIs"As is
@"Confidential"Confidential
@"Departmental"Departmental
@"Draft"Draft
@"Experimental"Experimental
@"Expired"Expired
@"Final"Final
@"ForComment"For comment
@"ForPublicRelease"For public release
@"NotApproved"Not approved
@"NotForPublicRelease"Not for public release
@"Sold"Sold
@"TopSecret"Top secret

Example: standard stamp

objc
#import <FoxitRDK/FSPDFObjC.h>

FSPDFPage *page = [doc getPage:0];

FSRectF *rect = [[FSRectF alloc] initWithLeft1:100 bottom1:600 right1:280 top1:660];
FSAnnot *annot = [page addAnnot:FSAnnotStamp rect:rect];
FSStamp *stamp = [[FSStamp alloc] initWithAnnot:annot];

[stamp setIconName:@"Approved"];
[stamp setBorderColor:0xFF009900];
[stamp setContent:@"已批准"];
[stamp resetAppearanceStream];

Custom bitmap stamp

Use setBitmap: with FSBitmap:

objc
#import <FoxitRDK/FSPDFObjC.h>

FSPDFPage *page = [doc getPage:0];

FSRectF *rect = [[FSRectF alloc] initWithLeft1:100 bottom1:400 right1:300 top1:500];
FSAnnot *annot = [page addAnnot:FSAnnotStamp rect:rect];
FSStamp *stamp = [[FSStamp alloc] initWithAnnot:annot];

UIImage *image = [UIImage imageNamed:@"my_stamp"];
FSBitmap *bitmap = [FSBitmap createFromUIImage:image];
[stamp setBitmap:bitmap];
[stamp resetAppearanceStream];

Stamp from FSImage

setImage:frame:compress_type: uses FSImage with frame index and compression:

objc
#import <FoxitRDK/FSPDFObjC.h>

FSPDFPage *page = [doc getPage:0];

FSRectF *rect = [[FSRectF alloc] initWithLeft1:100 bottom1:400 right1:300 top1:500];
FSAnnot *annot = [page addAnnot:FSAnnotStamp rect:rect];
FSStamp *stamp = [[FSStamp alloc] initWithAnnot:annot];

FSImage *image = [[FSImage alloc] initWithPath:@"path/to/stamp_image.jpg"];
[stamp setImage:image frame:0 compress_type:0];
[stamp resetAppearanceStream];

Rotation

objc
int rotation = [stamp getRotation];
[stamp setRotation:45];
[stamp rotate:90];

[stamp resetAppearanceStream];

Methods summary

MethodDescription
getIconName / setIconName:Standard icon name
setBitmap:Custom FSBitmap
setImage:frame:compress_type:FSImage with frame and compression
getRotation / setRotation:Rotation (degrees)
rotate:Incremental rotation