PSPDFPageView
Objective-C
@interface PSPDFPageView : UIView <PSPDFRenderTaskDelegate,
PSPDFResizableViewDelegate, PSPDFOverridable>
Swift
class PDFPageView : UIView, RenderTaskDelegate, ResizableViewDelegate, Overridable
Display a single PDF page. View is reused.
You can add your own views on top of the annotationContainerView
(e.g. custom annotations)
Events from a attached UIScrollView
will be relayed to all visible PDFPageView
classes.
-
Unavailable
Not the designated initializer
Undocumented
Declaration
Objective-C
PSPDF_EMPTY_INIT_UNAVAILABLE
-
Unavailable
Not the designated initializer
Undocumented
Declaration
Objective-C
PSPDF_EMPTY_INIT_UNAVAILABLE
-
The attached presentation context.
Declaration
Objective-C
@property (nonatomic, weak, readonly) id<PSPDFPresentationContext> _Nullable presentationContext;
-
Prepares the
PDFPageView
for reuse. Removes all unknown internalUIViews
. -
Redraw the
renderView
(dynamically rendered PDF for maximum sharpness, updated on every zoom level.) -
Redraw
renderView
andcontentView
. -
Call whenever you change which annotations should be rendered. Updates overlay annotations and will remove any annotation selection. In most cases this should be called in combination with
updateView
.Declaration
Objective-C
- (void)updateAnnotationViewsAnimated:(BOOL)animated;
Swift
func updateAnnotationViews(animated: Bool)
-
Returns the existing subview used to display the given annotation — if any.
This method will neither trigger loading annotations, nor create and insert a view for the given annotation. In addition, it will not return views that are scheduled to be removed.
Note
Unless they are currently selected, most annotations are rendered into the page. Whether or not a separate view will be used to display an annotation is controlled through itsisOverlay
property. In other words: This method always returns nil for annotations that returnfalse
fromisOverlay
and are not selected.Declaration
Objective-C
- (nullable UIView<PSPDFAnnotationPresenting> *)annotationViewForAnnotation: (nonnull PSPDFAnnotation *)annotation;
-
UIImageView displaying the whole document.
Declaration
Objective-C
@property (nonatomic, readonly) UIImageView *_Nonnull contentView;
Swift
var contentView: UIImageView { get }
-
UIImageView for the zoomed in state.
Declaration
Objective-C
@property (nonatomic, readonly) UIImageView *_Nonnull renderView;
Swift
var renderView: UIImageView { get }
-
Container view for all overlay annotations.
This is just a named subclass of
UIView
that will always track the frame of thePDFPageView
. It’s useful to coordinate this with your own subviews to get the zIndex right.Warning
Most annotations will not be rendered as overlays or only when they are currently being selected. Rendering annotations within the pageView has several advantages including performance or view color multiplication (in case of highlight annotations) The contents of this view are managed. Additional subviews can be added, but they will be removed during page reuse. Subviews should respond to thePSPDFAnnotationPresenting
, especially the annotation method.Declaration
Objective-C
@property (nonatomic, readonly) PSPDFAnnotationContainerView *_Nonnull annotationContainerView;
Swift
var annotationContainerView: AnnotationContainerView { get }
-
Access the selectionView. (handles text selection)
Declaration
Objective-C
@property (nonatomic, readonly) PSPDFTextSelectionView *_Nonnull selectionView;
Swift
var selectionView: PSPDFTextSelectionView { get }
-
Access the render status view that is displayed on top of a page while we are rendering.
Declaration
Objective-C
@property (nonatomic) PSPDFRenderStatusView *_Nonnull renderStatusView;
Swift
var renderStatusView: PSPDFRenderStatusView { get set }
-
Top right offset. Defaults to 30.
Declaration
Objective-C
@property (nonatomic) CGFloat renderStatusViewOffset;
Swift
var renderStatusViewOffset: CGFloat { get set }
-
The PDF scale the current page is rendered with.
Declaration
Objective-C
@property (nonatomic, readonly) CGFloat PDFScale;
Swift
var pdfScale: CGFloat { get }
-
Current CGRect of the part of the page that’s visible. Screen coordinate space.
Note
If the scroll view is currently decelerating, this will show the TARGET rect, not the one that’s currently animating.Declaration
Objective-C
@property (nonatomic, readonly) CGRect visibleRect;
Swift
var visibleRect: CGRect { get }
-
Color used to indicate link or form objects.
Declaration
Objective-C
@property (nonatomic) UI_APPEARANCE_SELECTOR UIColor *highlightColor;
Swift
var highlightColor: UIColor { get set }
-
The color displayed on the page view before the PDF page is rendered.
By default (assigned
nil
value), this value will be the best guess for the page background color, given the current render options (such asbackgroundFill
orinvertRenderColor
).This property is intended to be customized via
-[PSPDFViewControllerDelegate pdfViewController:didConfigurePageView:forPageAtIndex:]
,UIAppearance
or by subclassing this class.Declaration
Objective-C
@property (nonatomic, null_resettable) UIColor *placeholderColor;
Swift
var placeholderColor: UIColor! { get set }
-
The normalized PDF coordinate space of this view’s page. The origin of the space is the bottom-left corner of the displayed content.
Use this property together with the methods in the
UICoordinateSpace
protocol to convert between PDF page and view coordinate spaces. For example to find the location of aUITouch
in a page’s PDF coordinate space:let viewPoint = touch.location(in: pageView) let pdfPoint = pageView.convert(viewPoint, to: pageView.pdfCoordinateSpace)
Note
Important: Rectangles converted with this coordinate space must be well–formed! Do not, for example, try to convert something with a less–than–zero width…Read more in our Coordinate Space Conversions guide at https://pspdfkit.com/guides/ios/faq/coordinate-spaces/
Declaration
Objective-C
@property (nonatomic, readonly) id<UICoordinateSpace> _Nonnull pdfCoordinateSpace;
Swift
var pdfCoordinateSpace: UICoordinateSpace { get }
-
Get the glyphs/words on a specific page.
Declaration
Objective-C
- (nonnull NSDictionary<PSPDFObjectFinderType, id> *) objectsAtPoint:(CGPoint)viewPoint options:(nullable NSDictionary<PSPDFObjectFinderOption, NSValue *> *) options;
Swift
func objects(at viewPoint: CGPoint, options: [Document.ObjectFinderOption : NSValue]? = nil) -> [Document.ObjectFinderType : Any]
-
Get the glyphs/words on a specific rect. Usage e.g.
NSDictionary *objects = [pageView objectsAtRect:rect options:@{PSPDFObjectFinderOptionExtractWords: @ YES}]
;Declaration
Objective-C
- (nonnull NSDictionary<PSPDFObjectFinderType, id> *) objectsAtRect:(CGRect)viewRect options:(nullable NSDictionary<PSPDFObjectFinderOption, NSValue *> *) options;
Swift
func objects(at viewRect: CGRect, options: [Document.ObjectFinderOption : NSValue]? = nil) -> [Document.ObjectFinderType : Any]
-
Access the
UIScrollView
that is responsible for zooming this page view if available.Declaration
Objective-C
@property (nonatomic, readonly, nullable) UIScrollView *zoomView;
Swift
var zoomView: UIScrollView? { get }
-
Returns an array of
UIView
PSPDFAnnotationPresenting
objects currently in the view hierarchy.Declaration
Objective-C
@property (nonatomic, readonly) NSArray<UIView<PSPDFAnnotationPresenting> *> *_Nonnull visibleAnnotationViews;
-
Page that is displayed. Readonly.
Declaration
Objective-C
@property (nonatomic, readonly) PSPDFPageIndex pageIndex;
Swift
var pageIndex: PageIndex { get }
-
Shortcut to access the current page info of the set page.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) PSPDFPageInfo *pageInfo;
Swift
var pageInfo: PSPDFPageInfo? { get }
-
View for the selected annotation. Created and destroyed on the fly.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) PSPDFResizableView *annotationSelectionView;
Swift
var annotationSelectionView: ResizableView? { get }
-
The array of currently selected annotations and focused form elements on the page view.
Setting this property is equivalent to calling the
selectAnnotations:presentMenu:animated:
method withfalse
for bothpresentMenu
andanimated
parameters.Note
Selecting annotations requires the Annotation Editing feature to be enabled for your license (or the Electronic Signatures feature when selecting just signature annotations). Otherwise, only annotations with underlying content (such as sounds, files, notes and annotations with comments) can be selected.
Declaration
Objective-C
@property (nonatomic, copy, null_resettable) NSArray<PSPDFAnnotation *> *selectedAnnotations;
Swift
var selectedAnnotations: [Annotation]! { get set }
-
Select the given annotations as a result of user interaction and optionally present the menu for them.
Note
Selecting annotations requires the Annotation Editing feature to be enabled for your license (or the Electronic Signatures feature when selecting just signature annotations). Otherwise, only annotations with underlying content (such as sounds, files, notes and annotations with comments) can be selected.
Important: Calling this method will discard any previous annotation or content selection on this page view.
Declaration
Objective-C
- (void)selectAnnotations:(nonnull NSArray<PSPDFAnnotation *> *)annotations presentMenu:(BOOL)presentMenu animated:(BOOL)animated;
Swift
func select(annotations: [Annotation], presentMenu: Bool, animated: Bool)
-
Focus the given form element. This will discard any previous selection on this page view.
Note
Focusing form elements requires the Forms feature to be enabled for your license. Otherwise, calling this method will have no effect.
Important: Calling this method will discard any previous annotation or content selection on this page view.
Declaration
Objective-C
- (void)focusFormElement:(nonnull PSPDFFormElement *)formElement toggleValue:(BOOL)toggleValue animated:(BOOL)animated;
Swift
func focus(formElement: PSPDFFormElement, toggleValue: Bool, animated: Bool)
-
Deprecated
Deprecated in PSPDFKit 12 for iOS. Use ‘select(annotations:presentMenu:animated:)’ or ‘focus(formElement:toggleValue:animated:)’ instead.
Select the given annotation or focus the given form element.
Warning
This method is deprecated. To select annotations, use the
selectAnnotations:presentMenu:animated:
method instead. To focus form elements, use thefocusFormElement:toggleValue:animated:
method instead.Declaration
Objective-C
- (void)selectAnnotation:(nonnull PSPDFAnnotation *)annotation animated:(BOOL)animated;
Swift
func select(_ annotation: Annotation, animated: Bool)
-
Returns a menu item, that is used for creating a new annotation from the current text selection.
Note
Only supports highlight, underline, squiggly, strike out, redaction, and link annotation types.Note
Requires the Redaction license feature when passingPSPDFAnnotationStringRedaction
, returnsnil
otherwise.Declaration
Objective-C
- (nullable PSPDFMenuItem *)textSelectionMenuItemForCreatingAnnotationWithType: (nonnull PSPDFAnnotationString)annotationString;
Swift
func textSelectionMenuItemForCreatingAnnotation(withType annotationString: Annotation.Tool) -> PSPDFMenuItem?
-
Show the signature controller.
Declaration
Objective-C
- (void)showSignatureControllerAtRect:(CGRect)viewRect withTitle:(nullable NSString *)title signatureFormElement: (nullable PSPDFSignatureFormElement *)signatureFormElement options:(nullable NSDictionary< PSPDFPresentationOption, id> *)options animated:(BOOL)animated;
Swift
func showSignatureController(at viewRect: CGRect, withTitle title: String?, signatureFormElement: PSPDFSignatureFormElement?, options: [PresentationOption : Any]? = nil, animated: Bool)
-
Show signature menu.
Declaration
Objective-C
- (void)showNewSignatureMenuAtRect:(CGRect)viewRect signatureFormElement: (nullable PSPDFSignatureFormElement *)signatureFormElement options: (nullable NSDictionary<PSPDFPresentationOption, id> *)options animated:(BOOL)animated;
Swift
func showNewSignatureMenu(at viewRect: CGRect, signatureFormElement: PSPDFSignatureFormElement?, options: [PresentationOption : Any]? = nil, animated: Bool)
-
Show digital signature menu. Only shown when
signatureField
is signed already.Declaration
Objective-C
- (BOOL)showDigitalSignatureMenuForSignatureField: (nonnull PSPDFSignatureFormElement *)signatureField animated:(BOOL)animated;
Swift
func showDigitalSignatureMenu(forSignatureField signatureField: PSPDFSignatureFormElement, animated: Bool) -> Bool
-
Show menu if annotation/text is selected.
Declaration
Objective-C
- (void)showMenuIfSelectedAnimated:(BOOL)animated;
Swift
func showMenuIfSelected(animated: Bool)
-
Undocumented
Declaration
Objective-C
- (void)showMenuIfSelectedWithOption:(PSPDFContextMenuOption)contextMenuOption animated:(BOOL)animated;
Swift
func showMenuIfSelected(with contextMenuOption: ContextMenuOption, animated: Bool)
-
Shows a menu as appropriate for a context menu invocation at the given location.
Declaration
Objective-C
- (void)showMenuForPoint:(CGPoint)location animated:(BOOL)animated;
Swift
func showMenu(for location: CGPoint, animated: Bool)
-
The method that checks if the receiver can create annotations, optionally showing a message with the
PSPDFStatusHUD
.Declaration
Objective-C
- (BOOL)canCreateAnnotationsShowMessage:(BOOL)showMessage;
Swift
func canCreateAnnotationsShowMessage(_ showMessage: Bool) -> Bool
Parameters
showMessage
Specifies whether a message should be displayed if annotations cannot be created.
Return Value
true
if annotations can be created, elsefalse
. -
Deprecated
Deprecated in PSPDFKit 12 for iOS. Use ‘PDFViewController.interactions.tryToShowAnnotationMenu(at:in:)’ instead.
Attempt to present the legacy menu for creating an annotation at the given location.
Warning
This method is deprecated. To present the annotation creation menu programmatically, use the
PSPDFDocumentViewInteractions/tryToShowAnnotationMenuAtPoint:inCoordinateSpace:
method.Declaration
Objective-C
- (BOOL)showAnnotationMenuAtPoint:(CGPoint)viewPoint animated:(BOOL)animated;
Swift
func showAnnotationMenu(at viewPoint: CGPoint, animated: Bool) -> Bool
Return Value
A boolean value indicating whether the presentation succeeded.
-
Deprecated
Deprecated in PSPDFKit 12 for iOS. Use ‘select(annotations:presentMenu:animated:)’ instead.
Attempt to present a legacy menu for the given annotations.
When calling this method on iPad for a single note annotation, this method will present the comments view controller instead.
Warning
This method is deprecated. To programmatically present the menu for selected annotations, use the
selectAnnotations:presentMenu:animated:
method.Declaration
Objective-C
- (void)showMenuForAnnotations:(nonnull NSArray<PSPDFAnnotation *> *)annotations targetRect:(CGRect)targetRect option:(PSPDFContextMenuOption)contextMenuOption animated:(BOOL)animated;
Swift
func showMenu(for annotations: [Annotation], targetRect: CGRect, option contextMenuOption: ContextMenuOption, animated: Bool)
-
Deprecated
Deprecated in PSPDFKit 12 for iOS. Use ‘presentColorPicker(for:property:options:animated:completion:)’ instead.
Attempt to present a legacy menu for choosing a color for an annotation.
Warning
This method is deprecated. The color menu is now a child of the annotation menu. To present a color choice menu that’s detached from the annotation menu, use your own
UIEditMenuInteraction
orUIMenuController
.Declaration
Objective-C
- (void)selectColorForAnnotation:(nonnull PSPDFAnnotation *)annotation isFillColor:(BOOL)isFillColor;
Swift
func selectColor(for annotation: Annotation, isFillColor: Bool)
-
Deprecated
Deprecated in PSPDFKit 12 for iOS. Use ‘canPresentInspector(for:)’ instead.
Check if the annotation inspector should be used for the given annotations.
Warning
This method is deprecated. To check if the annotation inspector can be presented for a given array of annotations, use the
canPresentInspectorForAnnotations:
method.Declaration
Objective-C
- (BOOL)useAnnotationInspectorForAnnotations: (nonnull NSArray<PSPDFAnnotation *> *)annotations;
Swift
func useAnnotationInspector(for annotations: [Annotation]) -> Bool
-
Deprecated
Deprecated in PSPDFKit 12 for iOS. Use ‘presentInspector(for:options:animated:completion:)’ instead.
Present the annotation inspector for the given annotations.
Warning
This method is deprecated. To present the annotation inspector, use the
presentInspectorForAnnotations:options:animated:completion:
method.Declaration
Objective-C
- (nullable PSPDFAnnotationStyleViewController *) showInspectorForAnnotations: (nonnull NSArray<PSPDFAnnotation *> *)annotations options:(nullable NSDictionary<NSString *, id> *)options animated:(BOOL)animated;
Swift
func showInspector(for annotations: [Annotation], options: [String : Any]? = nil, animated: Bool) -> AnnotationStyleViewController?
Return Value
An instance of the annotation inspector view controller or
nil
if the annotation inspector couldn’t be presented for the given annotations. -
Deprecated
Deprecated in PSPDFKit 12 for iOS. Use ‘presentComments(for:options:animated:completion:)’ instead.
Present comments for the given annotation.
Warning
This method is deprecated. To present comments for an annotation, use the
presentCommentsForAnnotation:options:animated:completion:
method.Declaration
Objective-C
- (void)showNoteControllerForAnnotation:(nonnull PSPDFAnnotation *)annotation animated:(BOOL)animated;
Swift
func showNoteController(for annotation: Annotation, animated: Bool)
-
Deprecated
Deprecated in PSPDFKit 12 for iOS. Use ‘presentColorPicker(for:property:options:animated:completion:)’ instead.
Present the color picker for the given annotation.
Warning
This method is deprecated. To present a color picker for an annotation, use the
presentColorPickerForAnnotation:property:options:animated:completion:
method.Declaration
Objective-C
- (void)showColorPickerForAnnotation:(nonnull PSPDFAnnotation *)annotation animated:(BOOL)animated;
Swift
func showColorPicker(for annotation: Annotation, animated: Bool)
-
Deprecated
Deprecated in PSPDFKit 12 for iOS. Use ‘presentFontPicker(for:options:animated:completion:)’ instead.
Present the font picker for the given free text annotation.
Warning
This method is deprecated. To present the font picker for a free text annotation, use the
presentFontPickerForAnnotation:options:animated:completion
method.Declaration
Objective-C
- (void)showFontPickerForAnnotation: (nonnull PSPDFFreeTextAnnotation *)annotation animated:(BOOL)animated;
Swift
func showFontPicker(for annotation: PSPDFFreeTextAnnotation, animated: Bool)
-
Deprecated
Deprecated in PSPDFKit 12 for iOS. Use ‘presentLinkActionSheet(for:options:animated:completion:)’ instead.
Present the link menu for the given link annotation.
Warning
This method is deprecated. To present the action sheet for a link annotation, use
presentLinkActionSheetForAnnotation:options:animated:completion:
method.Declaration
Objective-C
- (BOOL)showLinkPreviewActionSheetForAnnotation: (nonnull PSPDFLinkAnnotation *)annotation fromRect:(CGRect)viewRect animated:(BOOL)animated;
Swift
func showLinkPreviewActionSheet(for annotation: PSPDFLinkAnnotation, from viewRect: CGRect, animated: Bool) -> Bool
Return Value
A boolean value that indicates whether the link menu was successfully presented.
-
Deprecated
Deprecated in PSPDFKit 12 for iOS. Use ‘PDFConfiguration.createAnnotationMenuGroups’ or ‘PDFViewControllerDelegate.pdfViewController(_:menuForCreatingAnnotationAt:onPageView:appearance:suggestedMenu:)’ instead.
Returns an array of menu items used for the legacy annotation creation menu.
Warning
This method is deprecated. To customize the annotation creation menu directly, use the
PSPDFViewControllerDelegate/pdfViewController:menuForCreatingAnnotationAtPoint:onPageView:appearance:suggestedMenu:
delegate method. See the documentation of that method to learn more about backwards compatibility considerations.Declaration
Objective-C
- (nonnull NSArray<PSPDFMenuItem *> *)menuItemsForNewAnnotationAtPoint: (CGPoint)point;
Swift
func menuItemsForNewAnnotation(at point: CGPoint) -> [PSPDFMenuItem]
Return Value
An array of menu items used for the legacy annotation creation menu.
-
Deprecated
Deprecated in PSPDFKit 12 for iOS. Use ‘PDFViewControllerDelegate.pdfViewController(_:menuForAnnotations:onPageView:appearance:suggestedMenu:)’ instead.
Returns an array of menu items used in the legacy annotation menu.
Warning
This method is deprecated. To customize the annotation menu directly, use
PSPDFViewControllerDelegate/pdfViewController:menuForAnnotations:onPageView:appearance:suggestedMenu:
delegate method. See the documentation of this method to learn more about backwards compatibility considerations.Declaration
Objective-C
- (nonnull NSArray<PSPDFMenuItem *> *)menuItemsForAnnotations: (nonnull NSArray<PSPDFAnnotation *> *)annotations;
Swift
func menuItems(for annotations: [Annotation]) -> [PSPDFMenuItem]
Return Value
An array of menu items used in the legacy annotation menu.
-
Deprecated
Deprecated in PSPDFKit 12 for iOS. Use ‘PDFConfiguration.annotationMenuConfiguration.colorChoices’ or ‘PDFViewControllerDelegate.pdfViewController(_:menuForAnnotations:onPageView:appearance:suggestedMenu:)’ instead.
Returns an array of menu items used in the legacy annotation menu to change the color of an annotation.
Warning
This method is deprecated. To customize the color choices available in the annotation menu, use the
annotationMenuConfiguration
configuration property. To customize the annotation menu directly, use thePSPDFViewControllerDelegate/pdfViewController:menuForAnnotations:onPageView:appearance:suggestedMenu:
delegate method.Declaration
Objective-C
- (nonnull NSArray<PSPDFMenuItem *> *)colorMenuItemsForAnnotation: (nonnull PSPDFAnnotation *)annotation;
Swift
func colorMenuItems(for annotation: Annotation) -> [PSPDFMenuItem]
Return Value
An array of menu items used in the legacy annotation menu.
-
Deprecated
Deprecated in PSPDFKit 12 for iOS. Use ‘PDFConfiguration.annotationMenuConfiguration.colorChoices’ or ‘PDFViewControllerDelegate.pdfViewController(_:menuForAnnotations:onPageView:appearance:suggestedMenu:)’ instead.
Returns an array of menu items used in the legacy annotation menu to change the fill color of an annotation.
Warning
This method is deprecated. To customize the fill color choices available in the annotation menu, use the
annotationMenuConfiguration
configuration property. To customize the annotation menu directly, use thePSPDFViewControllerDelegate/pdfViewController:menuForAnnotations:onPageView:appearance:suggestedMenu:
delegate method.Declaration
Objective-C
- (nonnull NSArray<PSPDFMenuItem *> *)fillColorMenuItemsForAnnotation: (nonnull PSPDFAnnotation *)annotation;
Swift
func fillColorMenuItems(for annotation: Annotation) -> [PSPDFMenuItem]
Return Value
An array of menu items used in the legacy annotation menu.
-
Deprecated
Deprecated in PSPDFKit 12 for iOS. Use ‘PDFConfiguration.annotationMenuConfiguration.alphaChoices’ or ‘PDFViewControllerDelegate.pdfViewController(_:menuForAnnotations:onPageView:appearance:suggestedMenu:)’ instead.
Returns a menu item used in the legacy annotation menu to change the opacity of an annotation.
Warning
This method is deprecated. To customize the opacity choices available in the annotation menu, use the
annotationMenuConfiguration
configuration property. To customize the annotation menu directly, use thePSPDFViewControllerDelegate/pdfViewController:menuForAnnotations:onPageView:appearance:suggestedMenu:
delegate method.Declaration
Objective-C
- (nonnull PSPDFMenuItem *) opacityMenuItemForAnnotation:(nonnull PSPDFAnnotation *)annotation withColor:(nullable UIColor *)color;
Swift
func opacityMenuItem(for annotation: Annotation, with color: UIColor?) -> PSPDFMenuItem
Return Value
A menu item used in the legacy annotation menu.
-
Deprecated
Deprecated in PSPDFKit 12 for iOS. Use ‘PDFConfiguration.annotationMenuConfiguration.colorChoices’ instead.
Returns an array of colors to display in the annotation menu for the given annotation.
Warning
This subclassing hook is deprecated. To customize color choices available in the annotation menu, use the
annotationMenuConfiguration
configuration property instead.Declaration
Objective-C
- (nonnull NSArray<UIColor *> *)defaultColorOptionsForAnnotationType: (PSPDFAnnotationType)annotationType;
Swift
func defaultColorOptions(for annotationType: Annotation.Kind) -> [UIColor]
-
Deprecated
Deprecated in PSPDFKit 12 for iOS. Use ‘PDFConfiguration.annotationMenuConfiguration.fontSizeChoices’ instead.
An array of font sizes to display in the annotation menu for compatible annotations.
Warning
This subclassing hook is deprecated. To customize font size choices available in the annotation menu, use the
annotationMenuConfiguration
configuration property instead.Declaration
Objective-C
@property (nonatomic, readonly) PSPDF_DEPRECATED( 12, "Use 'PDFConfiguration.annotationMenuConfiguration.fontSizeChoices' " "instead.") NSArray<NSNumber *> *availableFontSizes;
Swift
var availableFontSizes: [NSNumber] { get }
-
Deprecated
Deprecated in PSPDFKit 12 for iOS. Use ‘PDFConfiguration.annotationMenuConfiguration.lineWidthChoices’ instead.
An array of line widths to display in the annotation menu for compatible annotations.
Warning
This subclassing hook is deprecated. To customize line width choices available in the annotation menu, use the
annotationMenuConfiguration
configuration property instead.Declaration
Objective-C
@property (nonatomic, readonly) PSPDF_DEPRECATED( 12, "Use 'PDFConfiguration.annotationMenuConfiguration.lineWidthChoices' " "instead.") NSArray<NSNumber *> *availableLineWidths;
Swift
var availableLineWidths: [NSNumber] { get }
-
Deprecated
Deprecated in PSPDFKit 12 for iOS. Use ‘PDFViewControllerDelegate.pdfViewController(_:menuForAnnotations:onPageView:appearance:suggestedMenu:)’ instead.
A boolean value that indicates whether annotation style menu elements should be displayed as a sub-menu or an inline menu.
Warning
This subclassing hook is deprecated. To customize the annotation menu directly, use the
PSPDFViewControllerDelegate/pdfViewController:menuForAnnotations:onPageView:appearance:suggestedMenu:
delegate method and customize the.displayInline
option for the menu with.pspdfkit.style
identifier.Declaration
Objective-C
@property (nonatomic, readonly) BOOL shouldMoveStyleMenuEntriesIntoSubmenu;
Swift
var shouldMoveStyleMenuEntriesIntoSubmenu: Bool { get }
-
Deprecated
Deprecated in PSPDFKit 12 for iOS. Use ‘PresentationOption.popoverPassthroughViews’ when presenting view controllers instead.
An array of pass-through views for popover controller, e.g. the color picker or the annotation inspector. By default, this is fairly aggressive and returns the entire parent view controller’s view.
Warning
This subclassing hook is deprecated and no longer called since PSPDFKit 12 for iOS. To customize the pass-through views for view controllers presented in popovers, use one of the view controller presentation methods with a custom array of views for the
PSPDFPresentationOptionPopoverPassthroughViews
presentation option. Alternatively, override one of these methods in your subclass of `PSPDFPageView
and callsuper
with modified presentation options.Declaration
Objective-C
@property (nonatomic, readonly) PSPDF_DEPRECATED(12, "Use 'PresentationOption.popoverPassthroughViews' " "when presenting view controllers instead.") NSArray<UIView *> *passthroughViewsForPopoverController;
Swift
var passthroughViewsForPopoverController: [UIView] { get }
-
Associate an annotation with an annotation view
Declaration
Objective-C
- (void)setAnnotation:(nonnull PSPDFAnnotation *)annotation forAnnotationView: (nonnull UIView<PSPDFAnnotationPresenting> *)annotationView;
-
Recall the annotation associated with an annotation view
Declaration
Objective-C
- (nullable PSPDFAnnotation *)annotationForAnnotationView: (nonnull UIView<PSPDFAnnotationPresenting> *)annotationView;
-
Add an
annotation
to the current pageView. This will either queue a re-render of the PDF, or add anUIView
subclass for the matching annotation, depending on the annotation type and the value ofisOverlay
.Note
In PSPDFKit, annotations are managed in two ways:1) Annotations that are fixed and rendered with the page image. Those annotations are
PSPDFHighlightAnnotation
,PSPDFSquareAnnotation
,PSPDFInkAnnotation
and more. Pretty much all more or less “static” annotations are handled this way.2) Then, there are the more dynamic annotations like
PSPDFLinkAnnotation
andPSPDFNoteAnnotation
. Those annotations are not part of the rendered image but are actual subviews inPDFPageView
. Those annotations return YES on the isOverlay property.This method is called recursively with all annotation types except if they return isOverlay = NO. In case of isOverlay = NO, it will call updateView to re-render the page.
Warning
This will not change anything on the data model below. Also add an annotation to the document object.Declaration
Objective-C
- (void)addAnnotation:(nonnull PSPDFAnnotation *)annotation options:(nullable NSDictionary<NSString *, NSNumber *> *)options animated:(BOOL)animated;
Swift
func add(_ annotation: Annotation, options: [String : NSNumber]? = nil, animated: Bool)
-
Removes an
annotation
from the view, either by re-rendering the page image or removing a matching UIView-subclass of the annotation was added as an overlay.Note
This will not change the data model of the document.Declaration
Objective-C
- (BOOL)removeAnnotation:(nonnull PSPDFAnnotation *)annotation options: (nullable NSDictionary<NSString *, NSNumber *> *)options animated:(BOOL)animated;
Swift
func remove(_ annotation: Annotation, options: [String : NSNumber]? = nil, animated: Bool) -> Bool
-
Subclass to change shadow behavior.
Declaration
Objective-C
- (void)updateShadowAnimated:(BOOL)animated;
Swift
func updateShadow(animated: Bool)
-
Used to expand the tap point to make tapping objects easier. By default the rect has a size of 30 pixels.
Declaration
Objective-C
- (CGRect)hitTestRectForPoint:(CGPoint)viewPoint;
Swift
func hitTestRect(for viewPoint: CGPoint) -> CGRect
-
Called with the set of annotations that are now selected. Can be used to post-process annotations or enforce user changes.
Declaration
Objective-C
- (void)didSelectAnnotations:(nonnull NSArray<PSPDFAnnotation *> *)annotations;
Swift
func didSelect(_ annotations: [Annotation])
-
Called with the set of annotations that were selected, but are no longer. Can be used to post-process annotations or enforce user changes.
Declaration
Objective-C
- (void)didDeselectAnnotations: (nonnull NSArray<PSPDFAnnotation *> *)annotations;
Swift
func didDeselect(_ annotations: [Annotation])
-
Get annotation rect (PDF coordinate space)
Declaration
Objective-C
- (CGRect)rectForAnnotations:(nonnull NSArray<PSPDFAnnotation *> *)annotations;
Swift
func rect(for annotations: [Annotation]) -> CGRect
-
Render options that are used for the live-page rendering. (not for the cache) One way to use this would be to customize what annotations types will be rendered with the pdf. See
PSPDFRenderOptions
for a list of options.Declaration
Objective-C
- (nonnull PSPDFRenderOptions *)renderOptionsWithZoomScale:(CGFloat)zoomScale animated:(BOOL)animated;
Swift
func renderOptions(withZoomScale zoomScale: CGFloat, animated: Bool) -> RenderOptions
-
Helper to properly place an annotation.
Declaration
Objective-C
- (void)centerAnnotation:(nonnull PSPDFAnnotation *)annotation aroundPDFPoint:(CGPoint)pdfPoint;
Swift
func center(_ annotation: Annotation, aroundPDFPoint pdfPoint: CGPoint)
-
Load page annotations from the PDF.
Declaration
Objective-C
- (void)loadPageAnnotationsAnimated:(BOOL)animated blockWhileParsing:(BOOL)blockWhileParsing;
Swift
func loadPageAnnotations(animated: Bool, blockWhileParsing: Bool)
-
Computes a scale value suitable for computation of the line width to use during drawing and selection.
Declaration
Objective-C
@property (nonatomic, readonly) CGFloat scaleForPageView;
Swift
var scaleForPageView: CGFloat { get }
-
Change notification processing.
Declaration
Objective-C
- (void)annotationsAddedNotification:(nonnull NSNotification *)notification;
Swift
func annotationsAddedNotification(_ notification: Notification)
-
Undocumented
Declaration
Objective-C
- (void)annotationsRemovedNotification:(NSNotification *)notification NS_REQUIRES_SUPER;
Swift
func annotationsRemovedNotification(_ notification: Notification)
-
Undocumented
Declaration
Objective-C
- (void)annotationChangedNotification:(NSNotification *)notification NS_REQUIRES_SUPER;
Swift
func annotationChangedNotification(_ notification: Notification)
-
Customize if the
annotation
object should also transform the properties.Declaration
Objective-C
- (BOOL)shouldScaleAnnotationWhenResizing:(nonnull PSPDFAnnotation *)annotation usesResizeKnob:(BOOL)usesResizeKnob;
Swift
func shouldScaleAnnotation(whenResizing annotation: Annotation, usesResizeKnob: Bool) -> Bool
-
Customize annotation selection view.
Declaration
Objective-C
- (void)updateAnnotationSelectionView;
Swift
func updateAnnotationSelectionView()
-
Check if the annotation inspector can be presented for the given annotations.
PSPDF_KEEP_OBJC_SYMBOL
Declaration
Swift
@objc(canPresentInspectorForAnnotations:) open func canPresentInspector(for annotations: [Annotation]) -> Bool
Parameters
annotations
The array of potentially inspectable annotations.
Return Value
A boolean value that indicates whether the annotation inspector can be presented for the given annotations.
-
Present the annotation inspector for the given annotations. This will also select the given annotations if they aren’t already.
PSPDF_KEEP_OBJC_SYMBOL
Declaration
Swift
@discardableResult @objc(presentInspectorForAnnotations:options:animated:completion:) open func presentInspector(for annotations: [Annotation], options: [PresentationOption : Any] = [:], animated: Bool = true, completion: (() -> Void)? = nil) -> UIViewController?
Parameters
annotations
The array of annotations to inspect.
options
The presentation options.
animated
Whether to animate the presentation.
completion
The closure to execute when animation finishes.
Return Value
An instance of the annotation inspector view controller or
nil
if the annotation inspector couldn’t be presented for the given annotations.
-
Present comments for the given annotations. This will also select the given annotation if it isn’t already.
PSPDF_KEEP_OBJC_SYMBOL
Declaration
Swift
@discardableResult @objc(presentCommentsForAnnotation:options:animated:completion:) open func presentComments(for annotation: Annotation, options: [PresentationOption : Any] = [:], animated: Bool = true, completion: (() -> Void)? = nil) -> UIViewController?
Parameters
annotation
The annotation with comments.
options
The presentation options.
animated
Whether to animate the presentation.
completion
The closure to execute when animation finishes.
Return Value
An instance of the note annotation view controller or
nil
if comments couldn’t be presented for the given annotations.
-
Present the color picker for the given property of the given annotation. This will also select the given annotation if it isn’t already.
PSPDF_KEEP_OBJC_SYMBOL
Declaration
Swift
@discardableResult @objc(presentColorPickerForAnnotation:property:options:animated:completion:) open func presentColorPicker(for annotation: Annotation, property: AnnotationStyle.Key, options: [PresentationOption : Any] = [:], animated: Bool = true, completion: (() -> Void)? = nil) -> UIViewController?
Parameters
annotation
The annotation to modify.
property
A color property of the annotation.
options
The presentation options.
animated
Whether to animate the presentation.
completion
The closure to execute when animation finishes.
Return Value
An instance of the color picker view controller or
nil
if the color picker couldn’t be presented for the given property of the given annotation.
-
Present the font picker for the given free text annotation. This will also select the given annotation if it isn’t already.
PSPDF_KEEP_OBJC_SYMBOL
Declaration
Swift
@discardableResult @objc(presentFontPickerForAnnotation:options:animated:completion:) open func presentFontPicker(for annotation: FreeTextAnnotation, options: [PresentationOption : Any] = [:], animated: Bool = true, completion: (() -> Void)? = nil) -> UIViewController?
Parameters
annotation
The free text annotation to modify.
options
The presentation options.
animated
Whether to animate the presentation.
completion
The closure to execute when animation finishes.
Return Value
An instance of the font picker view controller or
nil
if the font picker couldn’t be presented for the given free text annotation.
-
Present the action sheet for the given link annotation. This will also select the given annotation, if it isn’t already.
PSPDF_KEEP_OBJC_SYMBOL
Declaration
Swift
@discardableResult @objc(presentLinkActionSheetForAnnotation:options:animated:completion:) open func presentLinkActionSheet(for annotation: LinkAnnotation, options: [PresentationOption : Any] = [:], animated: Bool = true, completion: (() -> Void)? = nil) -> UIViewController?
Parameters
annotation
The link annotation to present actions for.
options
The presentation options.
animated
Whether to animate the presentation.
completion
The closure to execute when animation finishes.
Return Value
An instance of the action sheet view controller or
nil
if the action sheet couldn’t be presented for the given link annotation.