PSPDFStampAnnotation


@interface PSPDFStampAnnotation : PSPDFAnnotation <PSPDFRotatable>

PDF stamp annotation.

Stamp annotations that have no image and no known stampType will render their title. title is a PSPDFKit addition that is not part of the PDF specification.

Note

Make sure you configured Image Permissions in your app. See https://pspdfkit.com/guides/ios/current/getting-started/permissions/#toc_image-permissions for further documentation.
  • Returns predefined colors for known names, like red for void or green for completed. Returns a default color (blue) for any other name, including nil and empty ones.

    Declaration

    Objective-C

    + (nonnull UIColor *)colorForStampType:(nullable PSPDFStampType)stampType;

    Swift

    class func color(for stampType: PSPDFStampType?) -> UIColor
  • Creates a new stamp annotation with a known identifier. Standard names are defined in the PDF specification. Most names that Adobe Acrobat creates are also supported. The stamp color will be set using using colorForStampType:.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithStampType:(nullable PSPDFStampType)stampType;

    Swift

    init(stampType: PSPDFStampType?)
  • Creates a new stamp annotation that displays custom text. The stamp color will be blue.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithTitle:(nullable NSString *)title;

    Swift

    init(title: String?)
  • Create a new stamp annotation with an image.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithImage:(nullable UIImage *)image;

    Swift

    init(image: UIImage?)
  • A standard, known stamp identifier.

    This is not text displayed to the user. It’s an identifier used to look up the image or localized text to display.

    The Name key in the PDF. Be careful not to confuse this with the name property on PSPDFAnnotation, which is the NM key in the PDF.

    Setting this to a standard type will change the title and subtitle to the predefined values for that type.

    Declaration

    Objective-C

    @property (readwrite, copy, atomic, nullable) PSPDFStampType stampType;

    Swift

    var stampType: PSPDFStampType? { get set }
  • The main text shown by the stamp. This is a PSPDFKit addition that is not part of the PDF specification. This is set automatically to the correct localized text when a standard stamp type is set. Usually this property should only be changed for stamps with no stamp type.

    Declaration

    Objective-C

    @property (readwrite, copy, atomic, nullable) NSString *title;

    Swift

    var title: String? { get set }
  • The text shown in the second line of a custom text stamp. This is a PSPDFKit addition that is not part of the PDF specification. This property does nothing for stamps with an image. Usually this property should not be set for stamps with a known stamp type.

    Declaration

    Objective-C

    @property (readwrite, copy, atomic, nullable) NSString *subtitle;

    Swift

    var subtitle: String? { get set }
  • The anti-clockwise angle of the annotation relative to the page, in degrees. The only supported values are 0, 90, 180, and 270. Defaults to 0.

    Declaration

    Objective-C

    @property (assign, readwrite, atomic) NSUInteger rotation;

    Swift

    var rotation: UInt { get set }
  • Stamp image. Defaults to nil. Set to render an image.

    Note

    An image set will take priority over the internal appearance stream.

    Declaration

    Objective-C

    @property (assign, readwrite, atomic, nullable) UIImage *image;

    Swift

    var image: UIImage? { get set }
  • Parses the AP stream, searches for an image and loads it. This can return nil if the image has been set manually.

    Note

    This will not update image or imageTransform - do that manually if required.

    Declaration

    Objective-C

    - (nullable UIImage *)
    loadImageWithTransform:(out nullable CGAffineTransform *)transform
                     error:(NSError *_Nullable *_Nullable)error;

    Swift

    func loadImage(with transform: UnsafeMutablePointer<CGAffineTransform>?) throws -> UIImage
  • Stamp image transform. Defaults to CGAffineTransformIdentity.

    Declaration

    Objective-C

    @property (assign, readwrite, atomic) CGAffineTransform imageTransform;

    Swift

    var imageTransform: CGAffineTransform { get set }
  • Return ‘best’ size to fit given size. does not actually resize the boundingBox. Will only work for simple stamp annotations with a subtext.

    Declaration

    Objective-C

    - (CGSize)sizeThatFits:(CGSize)size;

    Swift

    func sizeThatFits(_ size: CGSize) -> CGSize
  • Calls sizeThatFits: with the current boundingBox and changes the boundingBox.

    Declaration

    Objective-C

    - (void)sizeToFit;

    Swift

    func sizeToFit()
  • Deprecated

    Deprecated in PSPDFKit 8.1 for iOS. Use colorForStampType: instead.

    Old API to get the color of known standard stamp type. Use colorForStampType: instead.

    Declaration

    Objective-C

    + (nonnull UIColor *)stampColorForSubject:(nullable NSString *)subject;

    Swift

    class func stampColor(forSubject subject: String?) -> UIColor
  • Deprecated

    Deprecated in PSPDFKit 8.1 for iOS. For a standard stamp use initWithStampType:. For custom text use initWithTitle:.

    Old API to create a standard or custom stamp. The API has been clarified. For a standard stamp use initWithStampType:. For custom text use initWithTitle:.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithSubject:(nullable NSString *)subject;

    Swift

    init(subject: String?)
  • Deprecated

    Deprecated in PSPDFKit 8.1 for iOS. Use title instead.

    The main text shown by the stamp. This has been renamed. Use title instead.

    Declaration

    Objective-C

    @property (readwrite, copy, atomic, nullable) NSString *localizedSubject;

    Swift

    var localizedSubject: String? { get set }
  • Deprecated

    Deprecated in PSPDFKit 8.1 for iOS. Use subtitle instead.

    The text shown in the second line of a custom text stamp. This has been renamed. Use subtitle instead.

    Declaration

    Objective-C

    @property (readwrite, copy, atomic, nullable) NSString *subtext;

    Swift

    var subtext: String? { get set }
  • Deprecated

    Deprecated in PSPDFKit 8.1 for iOS. Consider stampType or title, or cast to PSPDFAnnotation if you really want the subject.

    Prior to PSPDFKit 8.1 for iOS and 3.1 for macOS, this was used as the text displayed by a stamp annotation. This property remains without deprecation on the superclass, PSPDFAnnotation. It no longer has any effect on rendering.

    If you want a standard stamp, use stampType instead. If you want a custom text stamp, use title instead. If you really want the subject, cast to PSPDFAnnotation and use the subject property.

    Declaration

    Objective-C

    @property (readwrite, copy, atomic, nullable) NSString *subject;

    Swift

    var subject: String? { get set }