PTPDFViewCtrlDelegate
@protocol PTPDFViewCtrlDelegate <NSObject>
The methods declared by the PTPDFViewCtrlDelegate protocol allow the adopting delegate to respond to messages from the PTPDFViewCtrl class.
-
Tells the delegate that a render job is complete.
Declaration
Objective-C
- (void)pdfViewCtrlOnRenderFinished:(nonnull PTPDFViewCtrl *)pdfViewCtrl;
Swift
optional func pdfViewCtrl(onRenderFinished pdfViewCtrl: PTPDFViewCtrl)
Parameters
pdfViewCtrl
The pdfViewCtrl for which rendering finished.
-
Tells the delegate that the page layout has changed (such as from cover to cover facing).
Declaration
Objective-C
- (void)pdfViewCtrlOnLayoutChanged:(nonnull PTPDFViewCtrl *)pdfViewCtrl;
Swift
optional func pdfViewCtrl(onLayoutChanged pdfViewCtrl: PTPDFViewCtrl)
Parameters
pdfViewCtrl
The pdfViewCtrl for which the layout changed.
-
Tells the delegate that the current page number changes. *
- - parameter: pdfViewCtrl The pdfViewCtrl which changed page numbers. *
- - parameter: oldPageNumber The previous page number. *
- - parameter: newPageNumber The new page number. *
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl pageNumberChangedFrom:(int)oldPageNumber To:(int)newPageNumber;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, pageNumberChangedFrom oldPageNumber: Int32, to newPageNumber: Int32)
-
Tells the delegate that PTPDFViewCtrl has opened a new document via its selector setDoc.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl onSetDoc:(nonnull PTPDFDoc *)doc;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, onSetDoc doc: PTPDFDoc)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
doc
The new document displayed by the PTPDFViewCtrl.
-
Tells the delegate that PTPDFViewCtrl has closed the current document.
Declaration
Objective-C
- (void)pdfViewCtrlDidCloseDoc:(nonnull PTPDFViewCtrl *)pdfViewCtrl;
Swift
optional func pdfViewCtrlDidCloseDoc(_ pdfViewCtrl: PTPDFViewCtrl)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
-
Tells the delegate that text search has commenced.
Declaration
Objective-C
- (void)pdfViewCtrlTextSearchStart:(nonnull PTPDFViewCtrl *)pdfViewCtrl;
Swift
optional func pdfViewCtrlTextSearchStart(_ pdfViewCtrl: PTPDFViewCtrl)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
-
Tells the delegate that a text search result has been found. The selection object can be passed to PDFViewCtrl’s highlightSelection:withColor: to easily highlight the text.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl textSearchResult:(nonnull PTSelection *)selection;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, textSearchResult selection: PTSelection)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
selection
An Selection object representing the location of the found text.
-
Tells the delegate that a download event has occured. (Occurs when downloading a document with OpenUrl:)
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl downloadEventType:(PTDownloadedType)type pageNumber:(int)pageNum message:(nullable NSString *)message;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, downloadEventType type: PTDownloadedType, pageNumber pageNum: Int32, message: String?)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
type
The type of the event.
pageNum
The number of the page that the event is for.
message
The message for the event, or
nil
if there is no message. -
Tells the delegate there was a download even error. (Occurs when downloading a document with OpenUrl:)
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl downloadError:(nonnull NSException *)exception;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, downloadError exception: NSException)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
exception
The type and reason for the error.
-
Returns a thumbnail requested by PDFViewCtrl’s selector GetThumbAsync:.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl gotThumbAsync:(int)page_num thumbImage:(nullable UIImage *)image;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, gotThumbAsync page_num: Int32, thumbImage image: UIImage?)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
page_num
The page number of the thumbnail.
image
The thumbnail image.
-
Tells the delegate when the user scrolls the content view within the receiver.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl pdfScrollViewDidScroll:(nonnull UIScrollView *)scrollView;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, pdfScrollViewDidScroll scrollView: UIScrollView)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
scrollView
The scrollview object in which the scrolling occurred.
-
Tells the delegate when the scroll view is about to start scrolling the content.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl pdfScrollViewWillBeginDragging:(nonnull UIScrollView *)scrollView;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, pdfScrollViewWillBeginDragging scrollView: UIScrollView)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
scrollView
The scroll-view object that is about to scroll the content view.
-
Tells the delegate when dragging ended in the scroll view.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl pdfScrollViewDidEndDragging:(nonnull UIScrollView *)scrollView willDecelerate:(BOOL)decelerate;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, pdfScrollViewDidEndDragging scrollView: UIScrollView, willDecelerate decelerate: Bool)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
scrollView
The scroll-view object that is about to scroll the content view.
decelerate
YES
if the scrolling movement will continue, but decelerate, after a touch-up gesture during a dragging operation. If the value isNO
, scrolling stops immediately upon touch-up. -
Asks the delegate if the scroll view should scroll to the top of the content.
If the delegate doesn’t implement this method,
YES
is assumed.Declaration
Objective-C
- (BOOL)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl pdfScrollViewShouldScrollToTop:(nonnull UIScrollView *)scrollView;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, pdfScrollViewShouldScrollToTop scrollView: UIScrollView) -> Bool
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
scrollView
The scroll-view object that perform the scrolling operation.
Return Value
YES to permit scrolling to the top of the content, NO to disallow it.
-
Tells the delegate that the scroll view scrolled to the top of the content.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl pdfScrollViewDidScrollToTop:(nonnull UIScrollView *)scrollView;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, pdfScrollViewDidScrollToTop scrollView: UIScrollView)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
scrollView
The scroll-view object that perform the scrolling operation.
-
Tells the delegate that the scroll view is starting to decelerate the scrolling movement.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl pdfScrollViewWillBeginDecelerating:(nonnull UIScrollView *)scrollView;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, pdfScrollViewWillBeginDecelerating scrollView: UIScrollView)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
scrollView
The scroll-view object that is decelerating the scrolling of the content view.
-
Tells the delegate that the scroll view has ended decelerating the scrolling movement.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl pdfScrollViewDidEndDecelerating:(nonnull UIScrollView *)scrollView;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, pdfScrollViewDidEndDecelerating scrollView: UIScrollView)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
scrollView
The scroll-view object that is decelerating the scrolling of the content view.
-
Tells the delegate that zooming of the content in the scroll view is about to commence.
This method is called at the beginning of zoom gestures and in cases where a change in zoom level is to be animated. You can use this method to store state information or perform any additional actions prior to zooming the view’s content.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl pdfScrollViewWillBeginZooming:(nonnull UIScrollView *)scrollView withView:(nullable UIView *)view;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, pdfScrollViewWillBeginZooming scrollView: UIScrollView, with view: UIView?)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
scrollView
The scrollview object displaying the content view.
view
The view object whose content is about to be zoomed.
-
Tells the delegate when the user zooms the content view within the receiver.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl pdfScrollViewDidEndZooming:(nonnull UIScrollView *)scrollView withView:(nullable UIView *)view atScale:(float)scale;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, pdfScrollViewDidEndZooming scrollView: UIScrollView, with view: UIView?, atScale scale: Float)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
scrollView
The scrollview object in which the scrolling occurred.
view
The view object representing that part of the content view that needs to be scaled.
scale
The scale factor to use for scaling.
-
Tells the delegate that the scroll view’s zoom factor changed.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl pdfScrollViewDidZoom:(nonnull UIScrollView *)scrollView;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, pdfScrollViewDidZoom scrollView: UIScrollView)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
scrollView
The scroll-view object whose zoom factor changed.
-
Allows the delegate to control if the scroll view can zoom via a pinch gesture.
Declaration
Objective-C
- (BOOL)pdfViewCtrlShouldZoom:(nonnull PTPDFViewCtrl *)pdfViewCtrl;
Swift
optional func pdfViewCtrlShouldZoom(_ pdfViewCtrl: PTPDFViewCtrl) -> Bool
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
Return Value
YES to permit the pinch zoom to proceed; NO to ignore the pinch zoom.
-
Tells the delegate when a scrolling animation in the scroll view concludes.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl pdfScrollViewDidEndScrollingAnimation:(nonnull UIScrollView *)scrollView;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, pdfScrollViewDidEndScrollingAnimation scrollView: UIScrollView)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
scrollView
The scroll-view object that is performing the scrolling animation.
-
Tells the delegate when the user taps on the scrollview.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl pdfScrollViewTap:(nonnull UITapGestureRecognizer *)gestureRecognizer;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, pdfScrollViewTap gestureRecognizer: UITapGestureRecognizer)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
gestureRecognizer
The gesture recognizer that detected the tap.
-
Tells the delegate when the user double taps on the scrollview.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl pdfScrollViewDoubleTap:(nonnull UITapGestureRecognizer *)gestureRecognizer;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, pdfScrollViewDoubleTap gestureRecognizer: UITapGestureRecognizer)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
gestureRecognizer
The gesture recognizer that detected the taps.
-
Tells the delegate when the user long presses on the scrollview.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl pdfScrollViewLongPress: (nonnull UILongPressGestureRecognizer *)gestureRecognizer;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, pdfScrollViewLongPress gestureRecognizer: UILongPressGestureRecognizer)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
gestureRecognizer
The gesture recognizer that deteted the longpress
-
Tells the delegate when the user scrolls the content view within the receiver.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl outerScrollViewDidScroll:(nonnull UIScrollView *)scrollView;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, outerScrollViewDidScroll scrollView: UIScrollView)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
scrollView
The scrollview object in which the scrolling occurred.
-
Tells the delegate when the scroll view is about to start scrolling the content.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl outerScrollViewWillBeginDragging:(nonnull UIScrollView *)scrollView;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, outerScrollViewWillBeginDragging scrollView: UIScrollView)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
scrollView
The scroll-view object that is about to scroll the content view.
-
Tells the delegate when dragging ended in the scroll view.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl outerScrollViewDidEndDragging:(nonnull UIScrollView *)scrollView willDecelerate:(BOOL)decelerate;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, outerScrollViewDidEndDragging scrollView: UIScrollView, willDecelerate decelerate: Bool)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
scrollView
The scroll-view object that is about to scroll the content view.
decelerate
YES
if the scrolling movement will continue, but decelerate, after a touch-up gesture during a dragging operation. If the value isNO
, scrolling stops immediately upon touch-up. -
Asks the delegate if the scroll view should scroll to the top of the content.
If the delegate doesn’t implement this method,
YES
is assumed.Declaration
Objective-C
- (BOOL)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl outerScrollViewShouldScrollToTop:(nonnull UIScrollView *)scrollView;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, outerScrollViewShouldScrollToTop scrollView: UIScrollView) -> Bool
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
scrollView
The scroll-view object that perform the scrolling operation.
Return Value
YES to permit scrolling to the top of the content, NO to disallow it.
-
Tells the delegate that the scroll view scrolled to the top of the content.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl outerScrollViewDidScrollToTop:(nonnull UIScrollView *)scrollView;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, outerScrollViewDidScrollToTop scrollView: UIScrollView)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
scrollView
The scroll-view object that perform the scrolling operation.
-
Tells the delegate that the scroll view is starting to decelerate the scrolling movement.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl outerScrollViewWillBeginDecelerating:(nonnull UIScrollView *)scrollView;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, outerScrollViewWillBeginDecelerating scrollView: UIScrollView)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
scrollView
The scroll-view object that is decelerating the scrolling of the content view.
-
Tells the delegate that the scroll view has ended decelerating the scrolling movement.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl outerScrollViewDidEndDecelerating:(nonnull UIScrollView *)scrollView;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, outerScrollViewDidEndDecelerating scrollView: UIScrollView)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
scrollView
The scroll-view object that is decelerating the scrolling of the content view.
-
Tells the delegate that zooming of the content in the scroll view is about to commence.
This method is called at the beginning of zoom gestures and in cases where a change in zoom level is to be animated. You can use this method to store state information or perform any additional actions prior to zooming the view’s content.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl outerScrollViewWillBeginZooming:(nonnull UIScrollView *)scrollView withView:(nullable UIView *)view;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, outerScrollViewWillBeginZooming scrollView: UIScrollView, with view: UIView?)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
scrollView
The scrollview object displaying the content view.
view
The view object whose content is about to be zoomed.
-
Tells the delegate when the user zooms the content view within the receiver.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl outerScrollViewDidEndZooming:(nonnull UIScrollView *)scrollView withView:(nullable UIView *)view atScale:(CGFloat)scale;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, outerScrollViewDidEndZooming scrollView: UIScrollView, with view: UIView?, atScale scale: CGFloat)
Parameters
scrollView
The scrollview object in which the scrolling occurred.
view
The view object representing that part of the content view that needs to be scaled.
scale
The scale factor to use for scaling.
-
Tells the delegate that the scroll view’s zoom factor changed.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl outerScrollViewDidZoom:(nonnull UIScrollView *)scrollView;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, outerScrollViewDidZoom scrollView: UIScrollView)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
scrollView
The scroll-view object whose zoom factor changed.
-
Tells the delegate when a scrolling animation in the scroll view concludes.
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl outerScrollViewDidEndScrollingAnimation:(nonnull UIScrollView *)scrollView;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, outerScrollViewDidEndScrollingAnimation scrollView: UIScrollView)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
scrollView
The scroll-view object that is performing the scrolling animation.
-
Generic event callback system for javascript action. Can be used to handle alert event which pops up a window with alert message
Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl javascriptCallback:(nullable const char *)event_type json:(nullable const char *)json;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, javascriptCallback event_type: UnsafePointer<CChar>?, json: UnsafePointer<CChar>?)
Parameters
pdfViewCtrl
The PDFViewCtrl for which this event occurred.
event_type
type name of the event, such as ‘alert’
json
the object that contains event data
-
Tells the
PTPDFViewCtrl
‘s delegate that the specified action parameter will be executed.Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl willExecuteActionWithActionParameter: (nonnull PTActionParameter *)actionParameter;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, willExecuteActionWith actionParameter: PTActionParameter)
Parameters
pdfViewCtrl
The PDFViewCtrl for which the action parameter will be executed.
actionParameter
The action parameter to be executed.
-
Tells the
PTPDFViewCtrl
‘s delegate that the specified action parameter was executed.Declaration
Objective-C
- (void)pdfViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl didExecuteActionWithActionParameter: (nonnull PTActionParameter *)actionParameter;
Swift
optional func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, didExecuteActionWith actionParameter: PTActionParameter)
Parameters
pdfViewCtrl
The PDFViewCtrl for which the action parameter was executed.
actionParameter
The action parameter that was executed.