PSPDFStampAnnotation


@interface PSPDFStampAnnotation : PSPDFAnnotation

PDF Stamp annotation.

  • Returns predefined colors for special subjects, like red for void or green for completed. Returns a default color if the subject is nil/empty.

    Declaration

    Objective-C

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

    Swift

    class func stampColor(forSubject subject: String?) -> UIColor
  • Init with a default subject and uses a matching color.

    Declaration

    Objective-C

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

    Swift

    init(subject: String?)
  • Init with image.

    Declaration

    Objective-C

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

    Swift

    init(image: UIImage?)
  • Stamp subtext. Used for custom stamps, will render beneath the subject or as the subject if subject is not set.

    Declaration

    Objective-C

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

    Swift

    var subtext: String? { get set }
  • If set, will be used instead of the subject for the rendered text. - note: To translate the default stamps like Approved or Accepted, you should use localizedSubject instead of changing subtext. Various strings are hardcoded to render differently according to the non-localized default stamps defined in the PDF spec. PSPDFKit renders appearance streams for stamps, so we can now localize the subtext but will still save the original, unlocalized title for compatibility reasons with readers that can’t render AP streams.

    Declaration

    Objective-C

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

    Swift

    var localizedSubject: String? { 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, nonatomic, 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
  • Stamp image transform. Defaults to CGAffineTransformIdentity.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) 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()