Stamp Annotations Configuration


PSPDFKit supports stamp annotations, which you can also customize to your liking. To change the default set of stamp annotations available for your application use setDefaultStampAnnotations: on PSPDFStampViewController.

Copy
1
2
3
4
5
6
7
8
9
10
var stamps = [PSPDFStampAnnotation]()
let stampNames = ["Great!", "Stamp", "Like"]

for name in stampNames {
    let stampAnnotation = PSPDFStampAnnotation(subject: name.uppercased())
    let suggestedSize = stampAnnotation.sizeThatFits(CGSize(width: 200, height: 100))
    stampAnnotation.boundingBox = CGRect(x: 0, y: 0, width: suggestedSize.width, height: suggestedSize.height)
    stamps.append(stampAnnotation)
}
PSPDFStampViewController.setDefaultStampAnnotations(stamps)
Copy
1
2
3
4
5
6
7
8
9
10
NSMutableArray<PSPDFStampAnnotation *> *stamps = [[NSMutableArray alloc] init];
NSArray<NSString *> *stampNames = @[@"Great!", @"Stamp", @"Like"];

for (NSString *name in stampNames) {
    PSPDFStampAnnotation *stampAnnotation = [[PSPDFStampAnnotation alloc] initWithSubject:name.uppercaseString];
    CGSize suggestedSize = [stampAnnotation sizeThatFits:CGSizeMake(200.f, 100.f)];
    stampAnnotation.boundingBox = CGRectMake(0, 0, suggestedSize.width, suggestedSize.height);
    [stamps addObject:stampAnnotation];
}
[PSPDFStampViewController setDefaultStampAnnotations:stamps];

Custom Stamps

Tip: You can retrieve the default set of stamp annotations defined by PSPDFKit using PSPDFStampViewController.defaultStampAnnotations.

Default Stamp Annotations

PSPDFKit comes with some out-of-the-box stamp annotations available in the stamp picker dialog.

Default Stamps

Note: When customStampEnabled is set to true (this is the default), a stamp, saying Custom... enabling the creation of a custom stamp the user can generate at runtime, is added to PSPDFStampViewController.

Image Stamp Annotations

PSPDFKit supports stamp annotations generated from a bitmap image. These annotations with supplied bitmap cannot have localized subject, subtext or text color. Use the image property on PSPDFStampAnnotation to create builder for bitmap stamp annotations.

Copy
1
stamp.image = UIImage(named: "exampleimage.jpg")
Copy
1
stamp.image = [UIImage imageNamed:@"exampleimage.jpg"];

Have a look at the PSCCustomStampAnnotationsExample inside the Catalog app, which shows how to create a different set of default stamp annotations.

Was this page helpful? We're happy to answer any questions.