Annotations
-
Base class for Line, Polygon and PolyLine annotations.
See moreDeclaration
Objective-C
@interface PSPDFAbstractLineAnnotation : PSPDFAbstractShapeAnnotation <PSPDFMeasurementAnnotation>
Swift
class AbstractLineAnnotation : AbstractShapeAnnotation, MeasurementAnnotation
-
The base class for Ink, Rectangle, Circle, Line, Polygon and PolyLine annotations.
These annotations are created in the UI using
See morePSPDFDrawView
.Declaration
Objective-C
@interface PSPDFAbstractShapeAnnotation : PSPDFAnnotation <PSPDFMeasurementAnnotation>
Swift
class AbstractShapeAnnotation : Annotation, MeasurementAnnotation
-
Base class for Highlight, Underline, StrikeOut and Squiggly annotations. You should never create instances of this class directly. Use one of its subclasses instead.
See moreDeclaration
Objective-C
@interface PSPDFTextMarkupAnnotation : PSPDFAnnotation
Swift
class TextMarkupAnnotation : Annotation
-
Annotation
is the base class for all PDF annotations and form elements.Don’t directly make an instance of this class, use subclasses like
NoteAnnotation
orLinkAnnotation
. This class will returnnil
if initialized directly, unless with the type.undefined
.AnnotationManager
searches the runtime for subclasses ofAnnotation
and builds up a dictionary usingsupportedTypes
.As well as the various annotation subclasses, there are two types to model annotation types:
Annotation.Kind
is mostly used for the type of an existing annotation. As an option set, it can be convenient to add and remote types from certain API such as thePDFConfiguration
’seditableAnnotationTypes
.Annotation.Tool
is mostly used as the type of a tool for creating annotations. As well as annotation types it includes pure tools such as.eraser
. The tools are activated in the UI withAnnotationToolbar
andAnnotationStateManager
.
Note
Thread safety: Annotation objects should only ever be edited on the main thread. Modify properties on the main thread only if they are already active (for creation, it doesn’t matter which thread creates them). Before rendering, obtain a copy of the annotation to ensure it’s not mutated while properties are read. Once the
documentProvider
is set, modifying properties on a background thread will throw an exception.Annotation properties are specified in normalized PDF coordinates: they take page rotation and
CropBox
offset into account. Prior to PSPDFKit 8 for iOS and PSPDFKit 3 for macOS properties were specified in PDF coordinates: not taking the page rotation and offset into account. After unarchiving annotations fromNSCoder
archives created with older versions of PSPDFKit, the properties will be untransformed, and will be modified to apply the page transform when the annotation is added to a document.Annotations contain internal state once they are attached to a document. Don’t take them and add them to another document. Instead, create a new annotation and set the properties relevant for you, and add this annotation.
For efficiency and control, you must manually notify PSPDFKit after modifying the properties of annotations. After changing any annotation properties, post an
.PSPDFAnnotationChanged
notification to ensure the annotation is re-rendered and the UI is updated. If you change multiple properties at once, you just need to post the notification once.Warning
Annotations are mutable objects. Do not store them inNSSet
or other objects that require a hash-value that does not change.Declaration
Swift
class Annotation : ModelObject
-
The types of author-specific state that may be associated with an annotation. States are grouped into categories defined by
See morePSPDFAnnotationAuthorStateModel
. See the Annotation States section in the PDF specification.Declaration
Objective-C
enum PSPDFAnnotationAuthorState : NSUInteger {}
-
Collects annotations from the various
PSPDFAnnotationProvider
implementations.Usually you want to add your custom PSPDFAnnotationProvider instead of subclassing this class. If you subclass, use
overrideClass:withClass:
inDocument
.This class will set the
See moredocumentProvider
on both annotation adding and retrieving. You don’t have to handle this in yourannotationProvider
subclass.Declaration
Objective-C
@interface PSPDFAnnotationManager : NSObject <PSPDFAnnotationProviderChangeNotifier, PSPDFOverridable>
Swift
class AnnotationManager : NSObject, AnnotationProviderChangeNotifier, Overridable
-
With the annotation provider, you can mix in PDF annotations from any source (custom database, web, etc) Implement your custom provider class and register it in the
PSPDFAnnotationManager
.(Make sure to register the provider in the PSPDFDocument’s
didCreateDocumentProvider:
method, since aDocument
can have multiplePSPDFDocumentProviders
and thus multiplePSPDFAnnotationProviders
- and they can also be discarded on low memory situations.)Ensure everything is thread safe here - methods will be called from any threads and sometimes even concurrently at the same time. (If you’re doing parsing, block and then in the queue re-check so you’re not parsing multiple times for the same page)
Note
You should always usePSPDFContainerAnnotationProvider
as the base class for your custom annotation provider.Declaration
Objective-C
@protocol PSPDFAnnotationProvider <NSObject>
Swift
protocol AnnotationProvider : NSObjectProtocol
-
An annotation set may be used to add and position multiple annotations.
See moreDeclaration
Objective-C
@interface PSPDFAnnotationSet : PSPDFModel <NSFastEnumeration>
Swift
class AnnotationSet : ModelObject, NSFastEnumeration
-
Defines an annotation style.
See moreDeclaration
Objective-C
@interface PSPDFAnnotationStyle : PSPDFModel
Swift
class AnnotationStyle : ModelObject
-
The annotation style manager will save UI-specific properties for annotations and apply them after creation.
It also offers a selection of user-defined styles. There are three categories: Last used, key-specific and generic styles.
See moreDeclaration
Objective-C
@protocol PSPDFAnnotationStyleManager
Swift
protocol AnnotationStyleManager
-
Produces a summary of the annotations in a document.
See moreDeclaration
Objective-C
@interface PSPDFAnnotationSummarizer : NSObject
Swift
class AnnotationSummarizer : NSObject
-
Abstract subclass that contains an asset from a link
See moreDeclaration
Objective-C
@interface PSPDFAssetAnnotation : PSPDFLinkAnnotation
Swift
class AssetAnnotation : LinkAnnotation
-
A caret annotation (PDF 1.5) is a visual symbol that indicates the presence of text edits, and share much similarity with note (text) annotations.
Declaration
Objective-C
@interface PSPDFCaretAnnotation : PSPDFAnnotation <PSPDFOverridable>
Swift
class CaretAnnotation : Annotation, Overridable
-
The PDF Circle annotations (PDF 1.3) shall display an ellipse on the page.
See moreDeclaration
Objective-C
@interface PSPDFCircleAnnotation : PSPDFAbstractShapeAnnotation <PSPDFOverridable>
Swift
class CircleAnnotation : AbstractShapeAnnotation, Overridable
-
Default container for annotations. It’s highly recommended that you use this class as your base class if you implement a custom annotation provider in order to leverage built-in functionality that ensures annotation changes are correctly propagated throughout the framework.
You must use this base class to support refreshing annotations in response to an external change, like from
See more-[PSPDFDocumentProvider setRotationOffset:forPageAtIndex:]
. To put that in other words, an annotation provider must subclass this class for temporary page rotations to work correctly.Declaration
Objective-C
@interface PSPDFContainerAnnotationProvider : NSObject <PSPDFAnnotationProvider>
Swift
class PDFContainerAnnotationProvider : NSObject, AnnotationProvider
-
Models a point used for natural drawing. Use
PSPDFDrawingPointFromCGPoint
to convert from a point with default intensity.Note
The type encoding of this struct needs to remain consistent, because drawing point data can be serialized in NSValue objects.Declaration
Objective-C
struct {}
Swift
struct DrawingPoint
-
Models a point used for natural drawing. Use
PSPDFDrawingPointFromCGPoint
to convert from a point with default intensity.Note
The type encoding of this struct needs to remain consistent, because drawing point data can be serialized in NSValue objects.Declaration
Objective-C
typedef struct PSPDFDrawingPoint PSPDFDrawingPoint
-
PDF File Attachment Annotation (see 12.5.6.15, “File attachment annotations”). A file attachment annotation (PDF 1.3) contains a reference to a file, which typically shall be embedded in the PDF file (see 7.11.4, “Embedded file streams”).
See moreDeclaration
Objective-C
@interface PSPDFFileAnnotation : PSPDFAnnotation <PSPDFOverridable>
Swift
class FileAnnotation : Annotation, Overridable
-
An implementation of the
PSPDFAnnotationProvider
protocol that uses the PDF document as source/target to load/save annotations. You almost always want to use thePSPDFFileAnnotationProvider
in yourPSPDFAnnotationManager
. You can also use this class inside a custom annotation provider, to parse PDF annotations once and then manage them in your custom database.Note
SubclassingPSPDFFileAnnotationProvider
will lead to slowerPSPDFProcessor
performance and is strongly discouraged. This will be blocked in future versions.Declaration
Objective-C
@interface PSPDFFileAnnotationProvider : PSPDFContainerAnnotationProvider <PSPDFOverridable>
Swift
class PDFFileAnnotationProvider : PDFContainerAnnotationProvider, Overridable
-
PDF FreeText Annotation.
A free text annotation (PDF 1.3) displays text directly on the page. Unlike an ordinary text annotation (see 12.5.6.4, “Text Annotations”), a free text annotation has no open or closed state; instead of being displayed in a pop-up window, the text shall be always visible.
See moreDeclaration
Objective-C
@interface PSPDFFreeTextAnnotation : PSPDFAnnotation <PSPDFRotatable, PSPDFOverridable>
Swift
class FreeTextAnnotation : Annotation, Rotatable, Overridable
-
Text Highlight Annotation
Warning
If you programmatically create a highlight annotation, you need to both set theboundingBox
AND the rects array. The rects array contains boxed variants ofCGRect
(NSValue
).Declaration
Objective-C
@interface PSPDFHighlightAnnotation : PSPDFTextMarkupAnnotation <PSPDFOverridable>
Swift
class HighlightAnnotation : TextMarkupAnnotation, Overridable
-
An ink annotation for freehand drawing or writing.
This annotation type is referred to as Drawing in the PSPDFKit UI. It allows the user to add one or more strokes on top of PDF content.
The
lines
are automatically scaled when theboundingBox
is changed, and theboundingBox
is updated when thelines
are changed to enclose the new points.See
The annotation tool is activated in the UI byPSPDFAnnotationStateManager
andAnnotationToolbar
. The drawing interaction is handled byPSPDFDrawView
. Some drawing-related behaviors can be set in thePDFConfiguration
, such as with itsdrawCreateMode
property, which controls whether a new ink annotation is created after each stroke).Declaration
Objective-C
@interface PSPDFInkAnnotation : PSPDFAbstractShapeAnnotation <PSPDFOverridable>
Swift
class InkAnnotation : AbstractShapeAnnotation, Overridable
-
Instant JSON versions
See moreDeclaration
Objective-C
enum PSPDFInstantJSONVersion : NSInteger {}
Swift
@frozen enum InstantJSONVersion : Int, @unchecked Sendable
-
PDF Line annotation.
See moreDeclaration
Objective-C
@interface PSPDFLineAnnotation : PSPDFAbstractLineAnnotation <PSPDFOverridable>
Swift
class LineAnnotation : AbstractLineAnnotation, Overridable
-
The
PSPDFLinkAnnotation
represents both classic PDF page/document/web links, and more types not supported by other PDF readers (video, audio, image, etc)PSPDFKit will automatically figure out the type for PDF link annotations loaded from a document, based on the file type. (“mp4” belongs to
.video
; a YouTube-URL to.youTube
, etc)If you create a
LinkAnnotation
at runtime, be sure to set the correct type and use the URL parameter for your link.boundingBox
defines the frame, in PDF space coordinates.If you want to customize how links look in the PDF, customize
See moreLinkAnnotationView
’s properties. There’s currently no mapping betweencolor
/lineWidth
/etc and the properties of the view. This might change in a future release.Declaration
Objective-C
@interface PSPDFLinkAnnotation : PSPDFAnnotation <PSPDFOverridable>
Swift
class LinkAnnotation : Annotation, Overridable
-
Annotations that have a measurement variant (ex.
See moreLineAnnotation
) implement this protocol. UseisMeasurement
to determine if the annotation really is a measurement.Declaration
Objective-C
@protocol PSPDFMeasurementAnnotation
Swift
protocol MeasurementAnnotation
-
PDF Note (Text) Annotation.
Note
Note annotations are rendered as fixed size; much like how Adobe Acrobat renders them. PSPDFKit will always render note annotations at a fixed size of 32x32pt. We recommend that you set theboundingBox
to the same value.Declaration
Objective-C
@interface PSPDFNoteAnnotation : PSPDFAnnotation <PSPDFOverridable>
Swift
class NoteAnnotation : Annotation, Overridable
-
Polyline annotations (PDF 1.5) are similar to polygons (`PSPDFPolygonAnnotation), except that the first and last vertex are not implicitly connected.
Note
SeePSPDFAbstractLineAnnotation
for details how to use and initialize.Declaration
Objective-C
@interface PSPDFPolyLineAnnotation : PSPDFAbstractLineAnnotation <PSPDFOverridable>
Swift
class PolyLineAnnotation : AbstractLineAnnotation, Overridable
-
Polygon annotations (PDF 1.5) display closed polygons on the page. Such polygons may have any number of vertices connected by straight lines. Polyline annotations (PDF 1.5) are similar to polygons, except that the first and last vertex are not implicitly connected.
Note
SeePSPDFAbstractLineAnnotation
for details how to use and initialize.Declaration
Objective-C
@interface PSPDFPolygonAnnotation : PSPDFAbstractLineAnnotation <PSPDFOverridable>
Swift
class PolygonAnnotation : AbstractLineAnnotation, Overridable
-
Undocumented
See moreDeclaration
Objective-C
@interface PSPDFPopupAnnotation : PSPDFAnnotation <PSPDFOverridable>
Swift
class PopupAnnotation : Annotation, Overridable
-
Redaction Annotation
Used to remove content from a document.
color
can be used to change the color of the overlay text. It has no effect if there is no overlay text specified. Defaults to a red color.fillColor
specifies the background color of the redaction area after is has been applied. The color is drawn on all the specifiedrects
. Defaults to black.lineWidth
can be set to change the border width of the redaction in its marked state. Defaults to 5.Note
Supports redacting text, images, paths, annotations, and forms.
Note
Redaction annotations need to be applied, after they were created and added to a document, to remove the content beneath them. See
PSPDFProcessorConfiguration
orPSPDFDocumentSaveOptionApplyRedactions
for further information.Warning
When programmatically creating a redaction annotation, both
boundingBox
andrects
need to be set. Therects
array contains boxed variants ofCGRect
(NSValue
).Declaration
Objective-C
@interface PSPDFRedactionAnnotation : PSPDFAnnotation <PSPDFOverridable>
Swift
class RedactionAnnotation : Annotation, Overridable
-
RichMedia annotations are defined in the ISO32000 Adobe Supplement and are the modern way of embedding video content. PSPDFKit also supports the matching
RichMediaExecute
action to control video state.Declaration
Objective-C
@interface PSPDFRichMediaAnnotation : PSPDFAssetAnnotation <PSPDFOverridable>
Swift
class RichMediaAnnotation : AssetAnnotation, Overridable
-
A screen annotation (PDF 1.5) specifies a region of a page upon which media clips may be played. It also serves as an object from which actions can be triggered. PSPDFKit also supports the matching Rendition Actions to control the video play state.
Note
iOS cannot play all video/audio formats that can be used for PDF.Declaration
Objective-C
@interface PSPDFScreenAnnotation : PSPDFAssetAnnotation <PSPDFOverridable>
Swift
class ScreenAnnotation : AssetAnnotation, Overridable
-
A sound annotation (PDF 1.2) shall analogous to a text annotation except that instead of a text note, it contains sound recorded from the iOS device’s microphone or imported from a file.
To ensure maximum compatibility set the
boundingBox
for sound annotations to the same size Adobe Acrobat uses (20x15pt). PSPDFKit will always render sound annotations at a fixed size of 74x44pt, centered in the providedboundingBox
.Note
Make sure you configured Microphone Permissions in your app. See https://pspdfkit.com/guides/ios/getting-started/permissions/#toc_microphone-permissions for further documentation.Declaration
Objective-C
@interface PSPDFSoundAnnotation : PSPDFAnnotation <PSPDFOverridable>
Swift
class SoundAnnotation : Annotation, Overridable
-
Manages sound playback for sound annotations.
See moreDeclaration
Objective-C
@interface PSPDFSoundAnnotationController : NSObject
Swift
class SoundAnnotationController : NSObject
-
The PDF Square annotations (PDF 1.3) shall display a rectangle on the page.
See moreDeclaration
Objective-C
@interface PSPDFSquareAnnotation : PSPDFAbstractShapeAnnotation <PSPDFOverridable>
Swift
class SquareAnnotation : AbstractShapeAnnotation, Overridable
-
Text Squiggly Annotation
Warning
If you programmatically create a squiggly annotation, you need to both set theboundingBox
AND therects
array. The rects array contains boxed variants ofCGRect
(NSValue
).Declaration
Objective-C
@interface PSPDFSquigglyAnnotation : PSPDFTextMarkupAnnotation <PSPDFOverridable>
Swift
class SquigglyAnnotation : TextMarkupAnnotation, Overridable
-
PDF stamp annotation.
Stamp annotations that have no
image
and no knownstampType
will render theirtitle
.title
is a PSPDFKit addition that is not part of the PDF specification.Stamps may be rotated using the
rotation
property fromPSPDFRotatable
.Note
Make sure you configured Image Permissions in your app. See https://pspdfkit.com/guides/ios/getting-started/permissions/#toc_image-permissions for further documentation.Declaration
Objective-C
@interface PSPDFStampAnnotation : PSPDFAnnotation <PSPDFRotatable, PSPDFOverridable>
Swift
class StampAnnotation : Annotation, Rotatable, Overridable
-
Text StrikeOut Annotation
Warning
If you programmatically create a strikeout annotation, you need to both set theboundingBox
AND therects
array. The rects array contains boxed variants ofCGRect
(NSValue
).Declaration
Objective-C
@interface PSPDFStrikeOutAnnotation : PSPDFTextMarkupAnnotation <PSPDFOverridable>
Swift
class StrikeOutAnnotation : TextMarkupAnnotation, Overridable
-
Text Underline Annotation
Warning
If you programmatically create an underline annotation, you need to both set theboundingBox
AND therects
array. The rects array contains boxed variants ofCGRect
(NSValue
).Declaration
Objective-C
@interface PSPDFUnderlineAnnotation : PSPDFTextMarkupAnnotation <PSPDFOverridable>
Swift
class UnderlineAnnotation : TextMarkupAnnotation, Overridable
-
The PDF ‘Widget’ annotation. A Widget usually is a button, much like a link annotation.
See moreDeclaration
Objective-C
@interface PSPDFWidgetAnnotation : PSPDFAnnotation <PSPDFOverridable>
Swift
class WidgetAnnotation : Annotation, Overridable
-
Advanced appearance characteristics for a widget annotation. It contains additional information for constructing the annotation’s appearance stream
See moreDeclaration
Objective-C
@interface PSPDFAppearanceCharacteristics : PSPDFModel <PSPDFOverridable>
Swift
class AppearanceCharacteristics : ModelObject, Overridable
-
Container object for storing a signature containing an ink annotation and an optional signer.
See moreDeclaration
Objective-C
@interface PSPDFSignatureContainer : NSObject <NSSecureCoding, PSPDFOverridable>
Swift
class SignatureContainer : NSObject, NSSecureCoding, Overridable
-
A instance of this protocol can be set on any
PSPDFAnnotation
and instead of using the PSPDFKit provided appearance stream generation methods, any PDF can be returned.The annotation will use the first page of the returned PDF as its appearance and this content will be embedded into the PDF.
See moreDeclaration
Objective-C
@protocol PSPDFAppearanceStreamGenerating <NSObject>
Swift
protocol AppearanceStreamGenerating : NSObjectProtocol
-
The default appearance stream generator.
Calls
See more-[PSPDFAnnotation drawInContext:options:]
and transforms it into an appearance stream.Declaration
Objective-C
@interface PSPDFDrawingContextAppearanceStreamGenerator : NSObject <PSPDFAppearanceStreamGenerating>
Swift
class DrawingContextAppearanceStreamGenerator : NSObject, AppearanceStreamGenerating
-
An appearance stream generator that makes sure to retain the current appearance stream.
Declaration
Objective-C
@interface PSPDFRetainExistingAppearanceStreamGenerator : NSObject <PSPDFAppearanceStreamGenerating>
Swift
class RetainExistingAppearanceStreamGenerator : NSObject, AppearanceStreamGenerating
-
An appearance stream generator that takes an
URL
to any PDF file and returns it as the appearance stream.Custom appearance streams are only intended to be used with stamp annotations to create a vector stamp. Using this class with other annotation types is not supported.
See moreDeclaration
Objective-C
@interface PSPDFFileAppearanceStreamGenerator : NSObject <PSPDFAppearanceStreamGenerating>
Swift
class FileAppearanceStreamGenerator : NSObject, AppearanceStreamGenerating
-
Annotations that can be rotated conform to this protocol.
Rotation is supported by these annotation types:
Free text annotations:
- Rotating is supported in all saving configurations.
Stamps:
- Only supported by standard text stamps (Acrobat stamps) and vector stamps (stamps that make use of
AppearanceStreamGenerating
).- These stamp types can only be rotated if the PDF document embeds the annotation into the document itself.
I.e. the
.embedded
annotation save mode or.embeddedWithExternalFileAsFallback
if the file is writable. - Rotation is not supported if the annotations are saved to an external file using the
.externalFile
save mode. - Rotation is also not supported when using XFDF (
XFDFAnnotationProvider
) to save annotations.
- These stamp types can only be rotated if the PDF document embeds the annotation into the document itself.
I.e. the
- Rotation is not supported for image stamps or custom text stamps.
Declaration
Objective-C
@protocol PSPDFRotatable <NSObject>
Swift
protocol Rotatable : NSObjectProtocol
-
Protocol allowing annotation updates.
See moreDeclaration
Objective-C
@protocol PSPDFAnnotationUpdate <NSObject>
Swift
protocol AnnotationUpdate : NSObjectProtocol
-
Property keys for annotation inspector customization.
See
PSPDFAnnotationStyleViewControllerSee
PSPDFConfigurationDeclaration
Objective-C
typedef NSString *PSPDFAnnotationStyleKey
-
Displays information about an annotation.
See moreDeclaration
Objective-C
@interface PSPDFAnnotationCell : PSPDFNonAnimatingTableViewCell <PSPDFOverridable>
Swift
class AnnotationCell : NonAnimatingTableViewCell, Overridable
-
A fully KVO observable stand in for actual annotation content that is loaded on demand.
Custom annotation providers may need to resolve certain annotation types using external sources. Instant, for example, only loads image annotations separately from the document and other annotations on demand, thus giving users the quickest possible time to display and sync, without sacrificing high fidelity for high bandwidth media.
This, however, requires a mechanism to display placeholder content for annotations whose media is not readily available.
PSPDFAnnotationPlaceholder
fulfills that role by offering a state machine that tracks the process towards replacing a suitable placeholder with the actual content.States and Allowed Transitions
Each annotation placeholder starts in an idle state. Any
PSPDFAnnotationPresenting
view that implements theannotationPlaceholder
property can use that object’scontent
to display a suitable placeholder until the actual content has become available.In order to provide feedback as to when the actual content will be available, it can observe the placeholder’s
placeholderState
, which will change to “progressing” or “failed” when the process of providing the actual content starts or has failed.Note
Important: In the context ofPSPDFAnnotationPlaceholder
, cancellation is considered an error. It will be signaled by anNSUserCancelled
error in combination with state “failed”.While the actual content for the placeholder instance is loaded, the object remains in state “progressing” until the process completes — which results in a transition to state “completed” — or fails — which results in a transition to state “failed”. Both of these states are final, meaning there will not be any further state transitions.
Upon transition to state “completed”, any
PSPDFAnnotationPresenting
view tracking a placeholder should dispose of the object, and use its newcontent
property instead.Upon transition to state “failed”, any such view should update based on the placeholder object’s error, which (in many cases) will provide a
See morelocalizedRecoverySuggestion
, alongside arecoveryAttempter
.Declaration
Objective-C
@interface PSPDFAnnotationPlaceholder : NSObject
Swift
class AnnotationPlaceholder : NSObject
-
Annotation Set cell, displays an annotation set.
See moreDeclaration
Objective-C
@interface PSPDFAnnotationSetCell : PSPDFSelectableCollectionViewCell <PSPDFOverridable>
Swift
class AnnotationSetCell : SelectableCollectionViewCell, Overridable
-
Shows multiple annotation sets within a table cell.
See moreDeclaration
Objective-C
@interface PSPDFAnnotationSetsCell : PSPDFTableViewCell <UICollectionViewDelegate, UICollectionViewDataSource>
Swift
class AnnotationSetsCell : PDFTableViewCell, UICollectionViewDelegate, UICollectionViewDataSource
-
AnnotationStateManager
holds the current annotation state and configures the associatedPDFViewController
to accept input related to the currently selected annotation state. The class also provides several convenience methods and user interface components required for annotation creation and configuration.Interested parties can use KVO to observe the manager’s properties.
You should never use more than one
AnnotationStateManager
for any givenPDFViewController
. It’s recommended to use-[PSPDFViewController annotationStateManager]
instead of creating your own one in order to make sure this requirement is always met.AnnotationStateManager
is internally used byAnnotationToolbar
and can be re-used for any custom annotation related user interfaces.Creating an annotation state manager requires either Annotations or Electronic Signatures to be enabled in your license. If you have Electronic Signatures without Annotations then the only state the manager may be put into is
.signature
Note
Do not create this class yourself. Use the existing class that is exposed in thePSPDFViewController.
Declaration
Objective-C
@interface PSPDFAnnotationStateManager : NSObject <PSPDFOverridable, UIPencilInteractionDelegate>
Swift
class AnnotationStateManager : NSObject, Overridable, UIPencilInteractionDelegate
-
Generic annotation view that listens on annotation changes.
See moreDeclaration
Objective-C
@interface PSPDFAnnotationView : UIView <PSPDFAnnotationPresenting>
Swift
class AnnotationView : UIView, AnnotationPresenting
-
Conforming to this protocol indicates instances can present an annotation and react to events such as page show/hide (to pause video, for example)
See moreDeclaration
Objective-C
@protocol PSPDFAnnotationPresenting <NSObject>
Swift
protocol AnnotationPresenting : NSObjectProtocol
-
Button that shows a selected color. Highlightable.
See moreDeclaration
Objective-C
@interface PSPDFColorButton : PSPDFButton <PSPDFOverridable>
Swift
class ColorButton : PDFButton, Overridable
-
PSPDFDrawView
allows drawing or erasing on top of aPDFPageView
and handles new annotation creation.Unless otherwise noted, boxed points need to be of type
See morePSPDFDrawingPoint
.Declaration
Objective-C
@interface PSPDFDrawView : PSPDFContainerView <PSPDFAnnotationPresenting, PSPDFOverridable>
Swift
class DrawView : PDFContainerView, AnnotationPresenting, Overridable
-
Draws a circle shape representing the user touch during erasing.
See moreDeclaration
Objective-C
@interface PSPDFEraseOverlay : UIView <PSPDFOverridable>
Swift
class EraseOverlay : UIView, Overridable
-
Generic view for form elements. Adds the form accessory view and additional keyboard support. Form views are not synced with the page to allow snappier editing.
Declaration
Objective-C
@interface PSPDFFormElementView : PSPDFHostingAnnotationView <PSPDFFormInputAccessoryViewDelegate>
Swift
class PDFFormElementView : HostingAnnotationView, PDFFormInputAccessoryViewDelegate
-
Toolbar for Next|Previous controls for Form Elements.
See moreDeclaration
Objective-C
@interface PSPDFFormInputAccessoryView : UIView <PSPDFOverridable>
Swift
class PDFFormInputAccessoryView : UIView, Overridable
-
Undocumented
See moreDeclaration
Objective-C
@protocol PSPDFFormInputAccessoryViewDelegate<NSObject> - (void)doneButtonPressedOnFormInputView:(PSPDFFormInputAccessoryView *)inputView; - (void)previousButtonPressedOnFormInputView:(PSPDFFormInputAccessoryView *)inputView; - (void)nextButtonPressedOnFormInputView:(PSPDFFormInputAccessoryView *)inputView; - (void)clearButtonPressedOnFormInputView:(PSPDFFormInputAccessoryView *)inputView; - (BOOL)formInputViewShouldEnablePreviousButton:(PSPDFFormInputAccessoryView *)inputView; - (BOOL)formInputViewShouldEnableNextButton:(PSPDFFormInputAccessoryView *)inputView; - (BOOL)formInputViewShouldEnableClearButton:(PSPDFFormInputAccessoryView *)inputView; @end
Swift
protocol PDFFormInputAccessoryViewDelegate : NSObjectProtocol
-
Free Text accessory toolbar for faster styling.
See moreDeclaration
Objective-C
@interface PSPDFFreeTextAccessoryView : PSPDFToolbar <PSPDFFontPickerViewControllerDelegate, PSPDFAnnotationStyleViewControllerDelegate, PSPDFOverridable>
Swift
class FreeTextAccessoryView : Toolbar, FontPickerViewControllerDelegate, AnnotationStyleViewControllerDelegate, Overridable
-
Free Text View. Allows inline text editing.
See moreDeclaration
Objective-C
@interface PSPDFFreeTextAnnotationView : PSPDFHostingAnnotationView <UITextViewDelegate, PSPDFOverridable>
Swift
class FreeTextAnnotationView : HostingAnnotationView, UITextViewDelegate, Overridable
-
View that will render an annotation.
See moreDeclaration
Objective-C
@interface PSPDFHostingAnnotationView : PSPDFAnnotationView <PSPDFRenderTaskDelegate, PSPDFOverridable>
Swift
class HostingAnnotationView : AnnotationView, RenderTaskDelegate, Overridable
-
Base class for all link-annotation subclasses.
See moreDeclaration
Objective-C
@interface PSPDFLinkAnnotationBaseView : UIView <PSPDFAnnotationPresenting>
Swift
class LinkAnnotationBaseView : UIView, AnnotationPresenting
-
Displays an annotation link.
See moreDeclaration
Objective-C
@interface PSPDFLinkAnnotationView : PSPDFLinkAnnotationBaseView <PSPDFOverridable>
Swift
class LinkAnnotationView : LinkAnnotationBaseView, Overridable
-
Renders a note annotation’s icon on its page. Note annotations are handled as subviews to be draggable.
See moreDeclaration
Objective-C
@interface PSPDFNoteAnnotationView : PSPDFAnnotationView <PSPDFOverridable>
Swift
class NoteAnnotationView : AnnotationView, Overridable
-
Captures touches and shows selection boxes during dragging. Shows the selection box during dragging when using the annotation selection tool. (The rectangle between the start location of dragging and the current touch location.) With the highlight tool, this also shows the proposed text to be highlighted. With the annotation selection tool, this also shows the proposed selected annotations. The selection color is determined by the
See moretintColor
property inherited fromUIView
. This is also used for text block debugging.Declaration
Objective-C
@interface PSPDFSelectionView : UIView <PSPDFOverridable>
Swift
class SelectionView : UIView, Overridable
-
Cell that is used for displaying a signature. Displays a label and an image beneath each other.
See moreDeclaration
Objective-C
@interface PSPDFSignatureCell : UITableViewCell <PSPDFOverridable>
Swift
class SignatureCell : UITableViewCell, Overridable
-
An object that stores signature annotations.
You can implement this protocol and set the object as the
PDFConfiguration
’ssignatureStore
to use your own backend for saving and loading the user’s signatures. Read more: https://pspdfkit.com/guides/ios/signatures/signature-storage/The store must support
NSSecureCoding
because the store is part of thePDFConfiguration
object. If your store requires any identifiers such as a store name or a username, ensure these are serialized and deserialized.If you want a simple on-device store, PSPDFKit provides
See moreKeychainSignatureStore
, which implements this protocol.Declaration
Objective-C
@protocol PSPDFSignatureStore <NSObject, NSSecureCoding>
Swift
protocol SignatureStore : NSSecureCoding, NSObjectProtocol