PTPDFViewCtrl

@interface PTPDFViewCtrl
    : UIView <UIScrollViewDelegate, UIGestureRecognizerDelegate,
              UIPrintInteractionControllerDelegate> {
  UIView *ContainerView;
  UIScrollView *innerScrollView;
  UIScrollView *outerScrollView;
}

PTPDFViewCtrl is a utility class that can be used for interactive rendering of PDF documents.

On iOS, PTPDFViewCtrl derives from UIView.

PTPDFViewCtrl defines several coordinate spaces and it is important to understand their differences:

  • Page Space refers to the space in which a PDF page is defined. It is determined by a page itself and the origin is at the lower-left corner of the page. Note that Page Space is independent of how a page is viewed in PDFView and each page has its own Page space.

  • Canvas Space refers to the tightest axis-aligned bounding box of all the pages given the current page presentation mode in PDFView. For example, if the page presentation mode is e_single_continuous, all the pages are arranged vertically with one page in each row, and therefore the Canvas Space is a rectangle with possibly large height value. For this reason, Canvas Space is also, like Page Space, independent of the zoom factor. Also note that since PDFView adds gaps between adjacent pages, the Canvas Space is larger than the space occupied by all the pages. The origin of the Canvas Space is located at the upper-left corner.

  • Screen Space (or Client Space) is the space occupied by PDFView and its origin is at the upper-left corner. Note that the virtual size of this space can extend beyond the visible region.

  • Scrollable Space is the virtual space within which PDFView can scroll. It is determined by the Canvas Space and the current zoom factor. Roughly speaking, the dimensions of the Scrollable Space is the dimensions of the Canvas Space timed by the zoom. Therefore, a large zoom factor will result in a larger Scrollable region given the same Canvas region. For this reason, Scrollable Space might also be referred to as Zoomed Canvas Space. Note that since PDFView adds gaps between pages in Canvas Space and these gaps are not scaled when rendered, the scrollable range is not exactly what the zoom factor times the Canvas range. For functions such as -SetHScrollPos:, -SetVScrollPos:, -GetCanvasHeight, and -GetCanvasWidth, it is the Scrollable Space that is involved.

    • Deprecated
    • The view that displays the PDF, that is the content view of a UIScrollView. Please use overlayView or toolsView for displaying content on top of the PDF.

    Declaration

    Objective-C

    UIView *ContainerView
  • Undocumented

    Declaration

    Objective-C

    UIScrollView* innerScrollView
  • Undocumented

    Declaration

    Objective-C

    UIScrollView* outerScrollView
  • A view that extends over the entire scrollable area of PTPDFViewCtrl. This view can be used to attach subviews for drawing custom content on top of the PDF.

    Declaration

    Objective-C

    @property (readonly, retain, nonatomic) UIView *overlayView;

    Swift

    var overlayView: UIView! { get }
  • A view that extends over the entire scrollable area of PTPDFViewCtrl, but under the overlayView. This view can be used to attach subviews for annotation handling (by default used by the included tools library).

    Declaration

    Objective-C

    @property (readonly, retain, nonatomic) UIView *toolOverlayView;

    Swift

    var toolOverlayView: UIView! { get }
  • An object that conforms to the PTPDFViewCtrlDelegate protocol.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) id<PTPDFViewCtrlDelegate> delegate;

    Swift

    unowned(unsafe) var delegate: PTPDFViewCtrlDelegate! { get set }
  • A UIView that conforms to the ToolDelegate protocol.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) id<PTTool> toolDelegate;

    Swift

    unowned(unsafe) var toolDelegate: PTTool! { get set }
  • Enables or disables the ability for the user to scroll the content.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL scrollEnabled;

    Swift

    var scrollEnabled: Bool { get set }
  • Enables or disables the ability for the user to pinch-zoom the control.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL zoomEnabled;

    Swift

    var zoomEnabled: Bool { get set }
  • Enables or disables the document’s use of a retina display. If it is disabled, the document will display at a non-retina resolution. Default is enabled.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL retinaEnabled;

    Swift

    var retinaEnabled: Bool { get set }
  • Enables or disables automatically calling PurgeMemory when a low memory warning is received. Default YES.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL purgeMemoryOnMemoryWarning;

    Swift

    var purgeMemoryOnMemoryWarning: Bool { get set }
  • A Boolean value that determines whether scrolling is disabled in a particular direction.

    Declaration

    Objective-C

    @property (getter=isDirectionalLockEnabled, assign, readwrite, nonatomic)
        BOOL directionalLockEnabled;

    Swift

    var isDirectionalLockEnabled: Bool { get set }
  • The behavior for determining the adjusted content offsets. This property specifies how the safe area insets are used to modify the content area of the scroll view. The default value of this property is Never.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        UIScrollViewContentInsetAdjustmentBehavior contentInsetAdjustmentBehavior;

    Swift

    var contentInsetAdjustmentBehavior: UIScrollView.ContentInsetAdjustmentBehavior { get set }
  • Associates this PTPDFViewCtrl with a given PDF document.

    Note

    SetDoc acquires a write lock on the document, so the document must be unlocked when this method is called or an exception will be thrown.

    Declaration

    Objective-C

    - (void)SetDoc:(PTPDFDoc *)doc;

    Swift

    func setDoc(_ doc: PTPDFDoc!)

    Parameters

    doc

    A document to be displayed in the view.

  • Declaration

    Objective-C

    - (PTPDFDoc *)GetDoc;

    Swift

    func getDoc() -> PTPDFDoc!

    Return Value

    Currently associated document with this PTPDFViewCtrl.

  • Closes the document currently opened in PTPDFViewCtrl.

    Note

    CloseDoc acquires a write lock on the document, so the document must be unlocked when this method is called or an exception will be thrown.

    Declaration

    Objective-C

    - (void)CloseDoc;

    Swift

    func closeDoc()
  • Sets the PDF document from a URL. If the PDF is linearized, PTPDFViewCtrl will display it incrementally while downloading it. If the PDF is not linearized, it will display blank pages until the entire document is downloaded.

    Note

    Currently, only the HTTP protocol is supported.

    Note

    This method will acquire a write lock on the document that is displayed in the viewer when this method is called, so it must be free of locks or an exception will be thrown.

    Declaration

    Objective-C

    - (void)OpenUrlAsync:(NSString *)url WithPDFPassword:(NSString *)password;

    Swift

    func openUrlAsync(_ url: String!, withPDFPassword password: String!)

    Parameters

    url

    The URL of the document to open.

    password

    The password used to open the PDF document if it is password protected.

  • Sets the PDF document from a URL. If the PDF is linearized, PTPDFViewCtrl will display it incrementally while downloading it. If the PDF is not linearized, it will display blank pages until the entire document is downloaded.

    Note

    Currently, only the HTTP protocol is supported.

    Note

    This method will acquire a write lock on the document that is displayed in the viewer when this method is called, so it must be free of locks or an exception will be thrown.

    Declaration

    Objective-C

    - (void)OpenUrlAsync:(NSString *)url
         WithPDFPassword:(NSString *)password
           WithCacheFile:(NSString *)fullPath;

    Swift

    func openUrlAsync(_ url: String!, withPDFPassword password: String!, withCacheFile fullPath: String!)

    Parameters

    url

    The URL of the document to open.

    password

    The password used to open the PDF document if it is password protected.

    fullPath

    The path to a file that will be used to cache the downloaded file which will be used to resume a download. If no cache file is specified, a file is created in the temporary directory.

  • Sets the PDF document from a URL. If the PDF is linearized, PTPDFViewCtrl will display it incrementally while downloading it. If the PDF is not linearized, it will display blank pages until the entire document is downloaded.

    Note

    Currently, only the HTTP protocol is supported.

    Note

    This method will acquire a write lock on the document that is displayed in the viewer when this method is called, so it must be free of locks or an exception will be thrown.

    Declaration

    Objective-C

    - (void)OpenUrlAsync:(NSString *)url
         WithPDFPassword:(NSString *)password
           WithCacheFile:(NSString *)fullPath
             WithOptions:(PTHTTPRequestOptions *)options;

    Swift

    func openUrlAsync(_ url: String!, withPDFPassword password: String!, withCacheFile fullPath: String!, with options: PTHTTPRequestOptions!)

    Parameters

    url

    The URL of the document to open.

    password

    The password used to open the PDF document if it is password protected.

    fullPath

    The path to a file that will be used to cache the downloaded file which will be used to resume a download. If no cache file is specified, a file is created in the temporary directory.

    options

    HTTP request options to use with every HTTP request

  • Get the current page displayed in the view.

    Declaration

    Objective-C

    - (int)GetCurrentPage;

    Swift

    func getCurrentPage() -> Int32

    Return Value

    the current page displayed in the view.

  • Get an array of NSNumbers with the pages currently visible on the screen.

    Declaration

    Objective-C

    - (NSMutableArray<NSNumber *> *)GetVisiblePages;

    Swift

    func getVisiblePages() -> NSMutableArray!

    Return Value

    an array of NSNumbers of the pages currently visible on the screen.

  • Find if a specific page is currently visible on the screen

    Declaration

    Objective-C

    - (BOOL)pageIsOnScreen:(int)pageNumber;

    Swift

    func pageIs(onScreen pageNumber: Int32) -> Bool

    Parameters

    pageNumber

    The page number of the page to check.

    Return Value

    true if the page is on screen, false otherwise.

  • Sets the current page to the given page.

    Declaration

    Objective-C

    - (_Bool)SetCurrentPage:(int)page_num;

    Swift

    func setCurrentPage(_ page_num: Int32) -> Bool

    Return Value

    true if successful, false otherwise.

  • Sets the current page to the first page in the document.

    Declaration

    Objective-C

    - (_Bool)GotoFirstPage;

    Swift

    func gotoFirstPage() -> Bool

    Return Value

    true if successful, false otherwise.

  • Sets the current page to the last page in the document.

    Declaration

    Objective-C

    - (_Bool)GotoLastPage;

    Swift

    func gotoLastPage() -> Bool

    Return Value

    true if successful, false otherwise.

  • Sets the current page to the next page in the document.

    Declaration

    Objective-C

    - (_Bool)GotoNextPage;

    Swift

    func gotoNextPage() -> Bool

    Return Value

    true if successful, false otherwise.

  • Sets the current page to the previous page in the document.

    Declaration

    Objective-C

    - (_Bool)GotoPreviousPage;

    Swift

    func gotoPreviousPage() -> Bool

    Return Value

    true if successful, false otherwise.

  • Get the current horizontal scroll position. The returned value is expressed in the canvas coordinate system. The canvas coordinate system is defined by a bounding box that surrounds all pages in the view.

    Declaration

    Objective-C

    - (double)GetHScrollPos;

    Swift

    func getHScrollPos() -> Double

    Return Value

    the current horizontal scroll position.

  • Get the current vertical scroll position. The returned value is expressed in the canvas coordinate system. The canvas coordinate system is defined by a bounding box that surrounds all pages in the view.

    Declaration

    Objective-C

    - (double)GetVScrollPos;

    Swift

    func getVScrollPos() -> Double

    Return Value

    the current vertical scroll position.

  • Sets the horizontal scroll position. The position should be a number in the range between 0 and -GetCanvasWidth and is expressed in the canvas coordinate system. The canvas coordinate system is defined by a bounding box that surrounds all pages in the view. If Animated is not specified, the default value is YES.

    Declaration

    Objective-C

    - (void)SetHScrollPos:(double)pos;

    Swift

    func setHScrollPos(_ pos: Double)

    Parameters

    pos

    the new horizontal scroll position.

  • Sets the horizontal scroll position. The position should be a number in the range between 0 and -GetCanvasWidth and is expressed in the canvas coordinate system. The canvas coordinate system is defined by a bounding box that surrounds all pages in the view.

    Declaration

    Objective-C

    - (void)SetHScrollPos:(double)pos Animated:(BOOL)animated;

    Swift

    func setHScrollPos(_ pos: Double, animated: Bool)

    Parameters

    pos

    The new horizontal scroll position.

    animated

    Whether to animate the change in scroll position.

  • Sets the vertical scroll position. The position should be a number in the range between 0 and -GetCanvasHeight and is expressed in the canvas coordinate system. The canvas coordinate system is defined by a bounding box that surrounds all pages in the view. If Animated is not specified, the default value is YES.

    Declaration

    Objective-C

    - (void)SetVScrollPos:(double)pos;

    Swift

    func setVScrollPos(_ pos: Double)

    Parameters

    pos

    The new vertical scroll position.

  • Sets the vertical scroll position. The position should be a number in the range between 0 and -GetCanvasHeight and is expressed in the canvas coordinate system. The canvas coordinate system is defined by a bounding box that surrounds all pages in the view.

    Declaration

    Objective-C

    - (void)SetVScrollPos:(double)pos Animated:(BOOL)animated;

    Swift

    func setVScrollPos(_ pos: Double, animated: Bool)

    Parameters

    pos

    The new vertical scroll position.

    animated

    Whether to animate the change in scroll position.

  • Returns the current zoom factor.

    Declaration

    Objective-C

    - (double)GetZoom;

    Swift

    func getZoom() -> Double

    Return Value

    current zoom (or scaling) component used to display the page content.

  • Sets the zoom factor to a new value. The function zooms to a point at the center of the rendering buffer.

    Declaration

    Objective-C

    - (void)SetZoom:(double)zoom;

    Swift

    func setZoom(_ zoom: Double)

    Parameters

    zoom

    new scaling component used to display the page content.

  • Sets the zoom factor to a new value using the given pixel coordinate (x,y) as a zoom center.

    The zoom point (x,y) is represented in the screen coordinate system, which starts in the upper-left corner of the client window.

    Declaration

    Objective-C

    - (void)SetZoomX:(int)x Y:(int)y Zoom:(double)zoom;

    Swift

    func setZoomX(_ x: Int32, y: Int32, zoom: Double)

    Parameters

    x

    the horizontal coordinate to zoom in.

    y

    the vertical coordinate to zoom in.

    zoom

    new scaling component used to display the page content.

  • Sets the zoom factor to a new value using the given pixel coordinate (x,y) to find an intersecting paragraph. The width of the paragraph helps to determine the zoom value, center of the paragraph is used as a zoom center. Paragraph has to contain more than one line and be wider than 1/5th of a page width. When called on a paragraph wider than current zoom level, or smart zoom cannot find something to zoom on, the method returns false. The zoom point (x,y) is represented in the screen space, which starts in the upper-left corner of the client window.

    Declaration

    Objective-C

    - (BOOL)SmartZoomX:(double)in_x y:(double)in_y animated:(BOOL)animated;

    Swift

    func smartZoomX(_ in_x: Double, y in_y: Double, animated: Bool) -> Bool

    Parameters

    in_x

    the horizontal coordinate to look for a text block.

    in_y

    the vertical coordinate to look for a text block.

    animated

    whether or not to animate the zooming

    Return Value

    true if successful, false if no zooming was performed.

  • Changes the viewing area to fit a rectangle rect on page page_num. The rectangle must be specified in page coordinates. This will adjust current page and zoom appropriately.

    Declaration

    Objective-C

    - (BOOL)ShowRect:(int)page_num rect:(PTPDFRect *)rect;

    Swift

    func showRect(_ page_num: Int32, rect: PTPDFRect!) -> Bool

    Parameters

    page_num

    the specified page number

    rect

    the rectangle to fit in

    Return Value

    true if successful, false otherwise.

  • Changes the viewing area to fit a rectangle in viewer coordinates.

    Declaration

    Objective-C

    - (void)zoomToRect:(CGRect)rect animated:(BOOL)animated;

    Swift

    func zoom(to rect: CGRect, animated: Bool)

    Parameters

    rect

    the rectangle to zoom in, in viewer coordinates.

    animated

    will animate zoom if YES, will not if NO.

  • Get the current page viewing mode.

    Declaration

    Objective-C

    - (TrnPageViewMode)GetPageViewMode;

    Swift

    func getPageViewMode() -> TrnPageViewMode

    Return Value

    the current page viewing mode

  • Sets the page viewing mode. The default PageView mode is e_trn_fit_width.

    Declaration

    Objective-C

    - (void)SetPageViewMode:(TrnPageViewMode)mode;

    Swift

    func setPageViewMode(_ mode: TrnPageViewMode)

    Parameters

    mode

    the new page viewing mode.

  • Sets the reference page view mode. In a non-continous page presentation mode, the reference page view mode is used to determine the page view mode upon a page change event. For example, if the reference page view mode is set to e_trn_fit_width, the new page coming in will be displayed with width-fit mode.

    Declaration

    Objective-C

    - (void)SetPageRefViewMode:(TrnPageViewMode)mode;

    Swift

    func setPageRefViewMode(_ mode: TrnPageViewMode)

    Parameters

    mode

    The reference page view mode to set. Valid values are e_trn_fit_page, e_trn_fit_width, and e_trn_fit_height.

  • Gets the reference page view mode. See more details about reference page view mode in -SetPageRefViewMode:.

    Declaration

    Objective-C

    - (TrnPageViewMode)GetPageRefViewMode;

    Swift

    func getPageRefViewMode() -> TrnPageViewMode

    Return Value

    the reference page view mode.

  • Get the current page presentation mode.

    Declaration

    Objective-C

    - (TrnPagePresentationMode)GetPagePresentationMode;

    Swift

    func getPagePresentationMode() -> TrnPagePresentationMode

    Return Value

    the current page presentation mode.

  • Determine if the current page presentation mode is continuous

    Declaration

    Objective-C

    - (BOOL)pagePresentationModeIsContinuous;

    Swift

    func pagePresentationModeIsContinuous() -> Bool

    Return Value

    true if the page presentation mode is continuous, false otherwise.

  • Sets the current page presentation mode. The default PagePresentationMode is e_trn_single_continuous.

    Declaration

    Objective-C

    - (void)SetPagePresentationMode:(TrnPagePresentationMode)mode;

    Swift

    func setPagePresentationMode(_ mode: TrnPagePresentationMode)

    Parameters

    mode

    the new page presentation mode.

  • Enables or disables URL extraction. By default URL extraction is disabled.

    Note

    If set to enabled when the document is already opened, it may not find links on pages that were already rendered. It is suggested to set this flag before opening the document.

    Declaration

    Objective-C

    - (void)SetUrlExtraction:(BOOL)enabled;

    Swift

    func setUrlExtraction(_ enabled: Bool)

    Parameters

    enabled

    if true URL extraction is enabled, if false URL extraction is disabled.

  • Enables or disables drawing of a thin border around each page.

    Declaration

    Objective-C

    - (void)SetPageBorderVisibility:(BOOL)border_visible;

    Swift

    func setPageBorderVisibility(_ border_visible: Bool)

    Parameters

    border_visible

    if true, the border will be visible.

  • Enables or disables the transparency grid (check board pattern) to reflect page transparency.

    Declaration

    Objective-C

    - (void)SetPageTransparencyGrid:(BOOL)trans_grid_visible;

    Swift

    func setPageTransparencyGrid(_ trans_grid_visible: Bool)

    Parameters

    trans_grid_visible

    if true, the grid is turned on.

  • Sets the default ‘paper’ color used to draw the background of each page.

    Declaration

    Objective-C

    - (void)SetDefaultPageColor:(unsigned char)r
                              g:(unsigned char)g
                              b:(unsigned char)b;

    Swift

    func setDefaultPageColor(_ r: UInt8, g: UInt8, b: UInt8)

    Parameters

    r

    red RGB color component

    g

    green RGB color component

    b

    blue RGB color component

  • Sets the default background color used to paint the area surrounding each page.

    Declaration

    Objective-C

    - (void)SetBackgroundColor:(unsigned char)r
                             g:(unsigned char)g
                             b:(unsigned char)b
                             a:(unsigned char)a;

    Swift

    func setBackgroundColor(_ r: UInt8, g: UInt8, b: UInt8, a: UInt8)

    Parameters

    r

    red RGBA color component

    g

    green RGBA color component

    b

    blue RGBA color component

    a

    alpha RGBA color component

  • Sets the horizontal alignment used for rendering pages within the view.

    Declaration

    Objective-C

    - (void)SetHorizontalAlign:(int)align;

    Swift

    func setHorizontalAlign(_ align: Int32)

    Parameters

    align

    an integer specifying the horizontal alignment. Depending of whether align is positive, negative, or zero, pages will be right, left, or center aligned: align<0, pages are top aligned; align=0, pages are centered; align>0, pages are bottom aligned.

  • Sets the vertical alignment used for rendering pages within the view.

    Declaration

    Objective-C

    - (void)SetVerticalAlign:(int)align;

    Swift

    func setVerticalAlign(_ align: Int32)

    Parameters

    align

    an integer specifying the vertical alignment. Depending of whether align is positive, negative, or zero, pages will be bottom, top, or center aligned: align<0, pages are top aligned; align=0, pages are centered; align>0, pages are bottom aligned.

  • Sets the vertical and horizontal padding and column spacing between adjacent pages in the view.

    Declaration

    Objective-C

    - (void)SetPageSpacing:(int)horiz_col_space
            vert_col_space:(int)vert_col_space
                 horiz_pad:(int)horiz_pad
                  vert_pad:(int)vert_pad;

    Swift

    func setPageSpacing(_ horiz_col_space: Int32, vert_col_space: Int32, horiz_pad: Int32, vert_pad: Int32)

    Parameters

    horiz_col_space

    horizontal column spacing (represented in pixels) between adjacent pages in the view. Default is 10.

    vert_col_space

    vertical column spacing (represented in pixels) between adjacent pages in the view. Default is 10.

    horiz_pad

    horizontal padding (represented in pixels) on the left and right side of the view. Default is 10.

    vert_pad

    vertical padding (represented in pixels) on the top and bottom side of the view. Default is 10.

  • Rotates all pages in the document 90 degrees clockwise.

    Declaration

    Objective-C

    - (void)RotateClockwise;

    Swift

    func rotateClockwise()
  • Rotates all pages in the document 90 degrees counter-clockwise.

    Declaration

    Objective-C

    - (void)RotateCounterClockwise;

    Swift

    func rotateCounterClockwise()
  • Get the current rotation applied to all pages in PTPDFViewCtrl.

    Declaration

    Objective-C

    - (PTRotate)GetRotation;

    Swift

    func getRotation() -> PTRotate

    Return Value

    The current rotation applied to all pages in PTPDFViewCtrl.

  • Set the color post processing transformation. This transform is applied to the rasterized bitmap as the final step in the rasterization process, and is applied directly to the resulting bitmap (disregarding any color space information). Color post processing is only supported for RGBA output.

    Declaration

    Objective-C

    - (void)SetColorPostProcessMode:(PTColorPostProcessMode)mode;

    Swift

    func setColorPostProcessMode(_ mode: PTColorPostProcessMode)

    Parameters

    mode

    the specific transform to be applied

  • Get the current color post processing mode.

    Declaration

    Objective-C

    - (PTColorPostProcessMode)GetColorPostProcessMode;

    Swift

    func getColorPostProcessMode() -> PTColorPostProcessMode

    Return Value

    the current color post processing mode.

  • Sets the color post processing transformation. This transform is applied to the rasterized bitmap as the final step in the rasterization process, and is applied directly to the resulting bitmap (disregarding any color space information). Color post processing only supported for RGBA output. This mode will map the brightness of the original rasterized bitmap to a gradient between whiteColor and blackColor

    Declaration

    Objective-C

    - (void)SetColorPostProcessColors:(UIColor *)white_color
                          black_color:(UIColor *)black_color;

    Swift

    func setColorPostProcessColors(_ white_color: UIColor!, black_color: UIColor!)

    Parameters

    white_color

    The white color of the page.

    black_color

    The black color of the page.

  • Sets whether the control will render progressively or will just draw once the entire view has been rendered.

    Note

    Progressive rendering is useful when a PDF page contain lots of elements (e.g. many vector paths, text, or many little images). When progressive rendering is enabled PDFNet will use painter algorithm to draw the page. This way user may be able to see partially rendered page. If a page contains only a single large image, there would be no visible benefit from progressive rendering.

    Declaration

    Objective-C

    - (void)SetProgressiveRendering:(BOOL)progressive
                   withInitialDelay:(int)delayMilliseconds
                       withInterval:(int)intervalMilliseconds;

    Swift

    func setProgressiveRendering(_ progressive: Bool, withInitialDelay delayMilliseconds: Int32, withInterval intervalMilliseconds: Int32)

    Parameters

    progressive

    if true the view will be rendered progressively

    delayMilliseconds

    delay before the progressive rendering timer is started.

    intervalMilliseconds

    delay between refreshes. Default is 750 ms.

  • Enable or disable path hinting.

    Path hinting is used to slightly adjust paths in order to avoid or alleviate artifacts of hair line cracks between certain graphical elements.

    This option is enabled by default.

    Declaration

    Objective-C

    - (void)SetPathHinting:(BOOL)enabled;

    Swift

    func setPathHinting(_ enabled: Bool)

    Parameters

    enabled

    if YES path hinting is enabled.

  • Enable or disable anti-aliasing.

    Anti-Aliasing is a technique used to improve the visual quality of images when displaying them on low resolution devices (for example, low DPI computer monitors).

    Anti-aliasing is enabled by default.

    Declaration

    Objective-C

    - (void)SetAntiAliasing:(_Bool)enabled;

    Swift

    func setAntiAliasing(_ enabled: Bool)
  • Set thin line adjustment parameters.

    Declaration

    Objective-C

    - (void)SetThinLineAdjustment:(_Bool)pixel_grid
                     StrokeAdjust:(_Bool)stroke_adjust;

    Swift

    func setThinLineAdjustment(_ pixel_grid: Bool, strokeAdjust stroke_adjust: Bool)

    Parameters

    pixel_grid

    if true (horizontal/vertical) thin lines will be snapped to integer pixel positions. This helps make thin lines look sharper and clearer. This option is turned off by default.

    stroke_adjust

    if true auto stroke adjustment is enabled. Currently, this would make lines with sub-pixel width to be one-pixel wide. This option is turned on by default.

  • Enable or disable image smoothing.

    The rasterizer allows a trade-off between rendering quality and rendering speed. This function can be used to indicate the preference between rendering speed and quality.

    Note

    The image smoothing option has effect only if the source image has higher resolution that the output resolution of the image on the rasterized page. PDFNet automatically controls at what resolution/zoom factor, ‘image smoothing’ needs to take effect.

    Image smoothing is enabled by default.

    Declaration

    Objective-C

    - (void)SetImageSmoothing:(_Bool)enabled;

    Swift

    func setImageSmoothing(_ enabled: Bool)

    Parameters

    enabled

    True to enable image smoothing, false otherwise.

  • Sets the gamma factor used for anti-aliased rendering.

    Gamma correction can be used to improve the quality of anti-aliased image output and can (to some extent) decrease the appearance of common anti-aliasing artifacts (such as pixel width lines between polygons).

    Note

    Gamma correction is used only in the built-in rasterizer.

    Declaration

    Objective-C

    - (void)SetGamma:(double)exp;

    Swift

    func setGamma(_ exp: Double)

    Parameters

    exp

    the exponent value of the gamma function. Typical values are in the range from 0.1 to 3.

  • Enable or disable annotation and forms rendering. By default, all annotations and form fields are rendered.

    Declaration

    Objective-C

    - (void)SetDrawAnnotations:(BOOL)render_annots;

    Swift

    func setDrawAnnotations(_ render_annots: Bool)

    Parameters

    render_annots

    True to draw annotations, false otherwise.

  • Enable or disable highlighting form fields. Default is disabled.

    Declaration

    Objective-C

    - (void)SetHighlightFields:(BOOL)highlight_fields;

    Swift

    func setHighlightFields(_ highlight_fields: Bool)

    Parameters

    highlight_fields

    YES to highlight, NO otherwise.

  • Enable or disable support for overprint and overprint simulation. Overprint is a device dependent feature and the results will vary depending on the output color space and supported colorants (i.e. CMYK, CMYK+spot, RGB, etc).

    By default overprint is only enabled for PDF/X files.

    Declaration

    Objective-C

    - (void)SetOverprint:(PTOverprintPreviewMode)op;

    Swift

    func setOverprint(_ op: PTOverprintPreviewMode)

    Parameters

    op

    e_ptop_on: always enabled; e_ptop_off: always disabled; e_ptop_pdfx_on: enabled for PDF/X files only.

  • Sets the Optional Content Group (OCG) context that should be used when viewing the document. This function can be used to change the current OCG context. Optional content (such as PDF layers) will be selectively rendered based on the states of optional content groups in the given context.

    Note

    Unlike -[PTPDFDraw SetOCGContext:] this method copies the given context. As a result, in order to modify the state of OCG groups in the current context use -GetOCGContext to obtain the currently selected content and then modify states.

    Declaration

    Objective-C

    - (void)SetOCGContext:(PTContext *)ctx;

    Swift

    func setOCGContext(_ ctx: PTContext!)

    Parameters

    ctx

    Optional Content Group (OCG) context, or nil if the rasterizer should render all content on the page.

  • Get the Optional Content Group (OCG) context associated with this PTPDFViewCtrl.

    Declaration

    Objective-C

    - (PTContext *)GetOCGContext;

    Swift

    func getOCGContext() -> PTContext!

    Return Value

    the Optional Content Group (OCG) context associated with this PTPDFViewCtrl, or nil (i.e. -[PTContext IsValid] is NO) if there is no OCG context associated with the view. If there is an OCG context associated with the view, optional content (such as PDF layers) will be selectively rendered based on the states of optional content groups in the given context.

  • Prompts the PDFViewCtrl to update its list of optional content groups. Call this method if you modify the PDFDoc in a way that adds or removes a layer. For example, after using Stamper to create a stamp.

    Declaration

    Objective-C

    - (void)UpdateOCGContext;

    Swift

    func updateOCGContext()
  • Selects text by searching for a given string of text.

    Note

    This function runs in asynchronous mode: it launches a search thread and returns immediately. If a matched string is found, the corresponding text is highlighted; otherwise, a message box is shown. Users can use SetCustomEventHandlers() to set a TextFindDoneHandler to customize a different behavior.

    Declaration

    Objective-C

    - (BOOL)FindText:(NSString *)searchString
             MatchCase:(BOOL)matchCase
        MatchWholeWord:(BOOL)matchWholeWord
              SearchUp:(BOOL)searchUp
                RegExp:(BOOL)regExp;

    Swift

    func findText(_ searchString: String!, matchCase: Bool, matchWholeWord: Bool, searchUp: Bool, regExp: Bool) -> Bool

    Parameters

    searchString

    The text to search for

    matchCase

    Indicates if it is case sensitive

    matchWholeWord

    Indicates if it matches an entire word only

    searchUp

    If it searches upward

    regExp

    Indicates if it uses regular expressions.

  • Cancel the text search thread if -FindText:MatchCase:MatchWholeWord:SearchUp:RegExp: is started in a different thread.

    Note

    If the text search thread is currently being suspended by the render thread, it will only be canceled after it is awaken by the render thread.

    Declaration

    Objective-C

    - (void)CancelFindText;

    Swift

    func cancelFindText()
  • Sets the selection mode used for text highlighting.

    Declaration

    Objective-C

    - (void)SetTextSelectionMode:(PTTextSelectionMode)tm;

    Swift

    func setTextSelectionMode(_ tm: PTTextSelectionMode)

    Parameters

    tm

    the text selection mode.

  • Places a rectangle over text that has been selected.

    Declaration

    Objective-C

    - (void)highlightSelection:(PTSelection *)selection withColor:(UIColor *)color;

    Swift

    func highlight(_ selection: PTSelection!, with color: UIColor!)

    Parameters

    selection

    A selection object.

    color

    The color of the drawn rectangle. Set the alpha value to less than 1.0 to give transparency.

  • Places a rectangle over text that has been selected.

    Declaration

    Objective-C

    - (void)highlightSelections:(NSArray<PTSelection *> *)selections
                      withColor:(UIColor *)color;

    Swift

    func highlight(_ selections: [PTSelection]!, with color: UIColor!)

    Parameters

    selections

    An array of PTSelection objects.

    color

    The color of the drawn rectangle. Set the alpha value to less than 1.0 to give transparency.

  • Clears the rectangle drawn by highlightSelection:withColor:.

    Declaration

    Objective-C

    - (void)hideSelectedTextHighlights;

    Swift

    func hideSelectedTextHighlights()
  • Checks if there is any text selection.

    Declaration

    Objective-C

    - (BOOL)HasSelection;

    Swift

    func hasSelection() -> Bool

    Return Value

    return true if there is selection, false otherwise.

  • Remove any text selection.

    Declaration

    Objective-C

    - (void)ClearSelection;

    Swift

    func clearSelection()
  • Get the text selection for a given page.

    Declaration

    Objective-C

    - (PTSelection *)GetSelection:(int)pagenum;

    Swift

    func getSelection(_ pagenum: Int32) -> PTSelection!

    Return Value

    the current text selection for a given page. If there is only selection on one page, then page number does not need to be provided.

  • Get the first page number that has text selection on it. Useful when there are selections on multiple pages at the same time.

    Declaration

    Objective-C

    - (int)GetSelectionBeginPage;

    Swift

    func getSelectionBeginPage() -> Int32

    Return Value

    the first page number that has text selection on it.

  • Get the last page number that has text selection on it. Useful when there are selections on multiple pages at the same time.

    Declaration

    Objective-C

    - (int)GetSelectionEndPage;

    Swift

    func getSelectionEndPage() -> Int32

    Return Value

    the last page number that has text selection on it.

  • Checks if there is any text selection on a given page. Useful when there are selections on multiple pages at the same time.

    Declaration

    Objective-C

    - (BOOL)HasSelectionOnPage:(int)ipage;

    Swift

    func hasSelection(onPage ipage: Int32) -> Bool

    Return Value

    returns true if given page number has any text selection on it.

  • Selects text within the given region using the current text selection mode. (x1, y1) and (x2, y2) are two points (screen coordinates, origin located at the upper-left corner of this view) defining the opposite corners of a selection rectangle.

    Declaration

    Objective-C

    - (BOOL)SelectX1:(double)x1 Y1:(double)y1 X2:(double)x2 Y2:(double)y2;

    Swift

    func selectX1(_ x1: Double, y1: Double, x2: Double, y2: Double) -> Bool

    Return Value

    true if some text was selected, false otherwise.

  • Selects text using structural mode. Point (x1, y1) is the start selection point (in page coordinates space) on page pageNumber1 and point (x2, y2) is the end selection point on page pageNumber2.

    Declaration

    Objective-C

    - (BOOL)SelectX1:(double)x1
                  Y1:(double)y1
         PageNumber1:(int)pageNumber1
                  X2:(double)x2
                  Y2:(double)y2
         PageNumber2:(int)pageNumber2;

    Swift

    func selectX1(_ x1: Double, y1: Double, pageNumber1: Int32, x2: Double, y2: Double, pageNumber2: Int32) -> Bool

    Return Value

    true if some text were selected, false otherwise.

  • Selects text identified by Highlights.

    Declaration

    Objective-C

    - (BOOL)SelectWithHighlights:(PTHighlights *)highlights;

    Swift

    func select(with highlights: PTHighlights!) -> Bool

    Parameters

    highlights

    an instance of the Highlights class.

    Return Value

    true if some text was selected, false otherwise.

  • Selects text identified by Selection.

    Declaration

    Objective-C

    - (BOOL)SelectWithSelection:(PTSelection *)select;

    Swift

    func select(with select: PTSelection!) -> Bool

    Parameters

    select

    an instance of the Selection class.

    Return Value

    true if some text was selected, false otherwise.

  • Selects all text on the page.

    Declaration

    Objective-C

    - (void)SelectAll;

    Swift

    func selectAll()
  • Returns the annotation bounding box present at the specified page number.

    Declaration

    Objective-C

    - (PTPDFRect *)GetScreenRectForAnnot:(PTAnnot *)annot page_num:(int)page_num;

    Swift

    func getScreenRect(for annot: PTAnnot!, page_num: Int32) -> PTPDFRect!

    Parameters

    annot

    The target annotation

    page_num

    The page number of the page where the annotation is on

    Return Value

    the annotation bounding box in screen points

  • Returns the annotation present at screen coordinates (x, y). If no annotation is present, callling IsValid on the returned annotation will return false. You must acquire a read lock for the doc when retrieving an annotation.

    Declaration

    Objective-C

    - (PTAnnot *)GetAnnotationAt:(int)x
                               y:(int)y
               distanceThreshold:(double)distanceThreshold
               minimumLineWeight:(double)minimumLineWeight;

    Swift

    func getAnnotationAt(_ x: Int32, y: Int32, distanceThreshold: Double, minimumLineWeight: Double) -> PTAnnot!

    Parameters

    x

    The x location in screen coordinates

    y

    The y location in screen coordinates

    distanceThreshold

    Maximum distance from the point (x, y) to the annotation for the annot to be considered a hit. The value used in versions of the SDK prior to 6.3 was 22.

    minimumLineWeight

    For very thin lines, it is almost impossible to hit the actual line. This specifies a minimum line thickness (in screen coordinates) for the purpose of calculating whether a point is inside the annotation or not. The value used in versions of the SDK prior to 6.3 was 10.

    Return Value

    the annotation at (x, y). If there is no annotation at (x, y), the returned annotation’s IsValid method will return false.

  • Set the pixel density so that annotations that have nozoom flag set can be scaled on high-resolution displays.

    Declaration

    Objective-C

    - (void)SetDevicePixelDensity:(double)dpi scale_factor:(double)scale_factor;

    Swift

    func setDevicePixelDensity(_ dpi: Double, scale_factor: Double)
  • Returns the annotation present at screen coordinates (x, y). If no link is present, callling length on the string returned by getUrl of the returned LinkInfo object will be <= 0. You must acquire a read lock for doc when retrieving a LinkInfo object.

    Declaration

    Objective-C

    - (PTLinkInfo *)GetLinkAt:(int)x y:(int)y;

    Swift

    func getLinkAt(_ x: Int32, y: Int32) -> PTLinkInfo!

    Parameters

    x

    The x location in screen coordinates

    y

    The y location in screen coordinates

    Return Value

    link information for a link present at screen coordinates (x, y).

  • Enables or disables requiring two fingers to scroll the viewer.

    Declaration

    Objective-C

    - (void)setMinimumTwoFingersToScrollEnabled:(_Bool)enabled;

    Swift

    func setMinimumTwoFingersToScrollEnabled(_ enabled: Bool)

    Parameters

    enabled

    To require two fingers to scroll send YES; otherwise NO.

  • Called in response to a single tap gesture and is included here so that subclasses may extend or override the functionality.

    Declaration

    Objective-C

    - (void)handleTap:(UITapGestureRecognizer *)gestureRecognizer;

    Swift

    func handleTap(_ gestureRecognizer: UITapGestureRecognizer!)

    Parameters

    gestureRecognizer

    The gesture recognizer that trigger the callback.

  • Called in response to a long press gesture and is included here so that subclasses may extend or override the functionality.

    Declaration

    Objective-C

    - (void)handleLongPress:(UILongPressGestureRecognizer *)gestureRecognizer;

    Swift

    func handleLongPress(_ gestureRecognizer: UILongPressGestureRecognizer!)

    Parameters

    gestureRecognizer

    The gesture recognizer that trigger the callback.

  • Acquires a write lock for PTPDFDoc instance used by PTPDFViewCtrl. Simultaneous write access to a PTPDFDoc instance is not allowed. A write lock cannot be acquired if the thread already holds a read lock. Attempting to do so will throw an exception.

    Declaration

    Objective-C

    - (void)DocLock:(BOOL)cancelThreads;

    Swift

    func docLock(_ cancelThreads: Bool)

    Parameters

    cancelThreads

    If true, other threads accessing the document are terminated before trying to lock the document. This ensures a quick return from this function. Otherwise, this function can halt the UI and the app may be unresponsive before the other thread finishes. If the rendering thread is canceled, unlocking the document UnlockDoc will restart the rendering thread.

  • Tries to acquire a write lock on the PTPDFDoc instance used by PTPDFViewCtrl. Returns true if it succeeds and false otherwise.

    Declaration

    Objective-C

    - (BOOL)DocTryLock:(int)milliseconds;

    Swift

    func docTryLock(_ milliseconds: Int32) -> Bool

    Parameters

    milliseconds

    time that the selector will block while trying to aquire the lock before returning.

    Return Value

    true if the lock was aquired, false otherwise.

  • Releases a write lock on the PTPDFDoc instance used by PTPDFViewCtrl and restarts the rendering thread if it was canceled.

    Declaration

    Objective-C

    - (void)DocUnlock;

    Swift

    func docUnlock()
  • Acquires a read lock for PTPDFDoc instance used by PTPDFViewCtrl.

    Declaration

    Objective-C

    - (void)DocLockRead;

    Swift

    func docLockRead()
  • Tries to acquire read lock on the PTPDFDoc instance used by PTPDFViewCtrl. Returns true if it succeeds and false otherwise.

    Declaration

    Objective-C

    - (BOOL)DocTryLockRead:(int)milliseconds;

    Swift

    func docTryLockRead(_ milliseconds: Int32) -> Bool

    Parameters

    milliseconds

    time that the selector will block while trying to aquire the lock before returning.

    Return Value

    true if the lock was aquired, false otherwise.

  • Releases a read lock on the PTPDFDoc instance used by PTPDFViewCtrl.

    Declaration

    Objective-C

    - (void)DocUnlockRead;

    Swift

    func docUnlockRead()
  • Sets the minimum and maximum zoom bounds of PTPDFViewCtrl.

    Note

    if the zoom limits are relative, 1.0 is defined as the zoom level where the document is displayed in page fit mode, where the entire page is visible on screen.

    Declaration

    Objective-C

    - (void)SetZoomLimits:(TrnZoomLimitMode)mode
                  Minimum:(double)min
                 Maxiumum:(double)max;

    Swift

    func setZoomLimits(_ mode: TrnZoomLimitMode, minimum min: Double, maxiumum max: Double)

    Parameters

    mode

    defines how the zoom bounds are to be used

    min

    the minimum zoom bound

    max

    the maximum zoom bound

  • Declaration

    Objective-C

    - (int)GetPageNumberFromScreenPt:(double)x y:(double)y;

    Swift

    func getPageNumber(fromScreenPt x: Double, y: Double) -> Int32

    Return Value

    the number of the page located under the given screen coordinate. The positive number indicates a valid page, whereas number less than 1 means that no page was found.

  • Converts a point expressed in screen coordinates to a point on canvas.

    Declaration

    Objective-C

    - (PTPDFPoint *)ConvScreenPtToCanvasPt:(PTPDFPoint *)pt;

    Swift

    func convScreenPt(toCanvasPt pt: PTPDFPoint!) -> PTPDFPoint!
  • Converts a point expressed in canvas coordinates to a point on screen.

    Declaration

    Objective-C

    - (PTPDFPoint *)ConvCanvasPtToScreenPt:(PTPDFPoint *)pt;

    Swift

    func convCanvasPt(toScreenPt pt: PTPDFPoint!) -> PTPDFPoint!
  • Converts a point expressed in canvas coordinates to a point on a given page.

    Declaration

    Objective-C

    - (PTPDFPoint *)ConvCanvasPtToPagePt:(PTPDFPoint *)pt page_num:(int)page_num;

    Swift

    func convCanvasPt(toPagePt pt: PTPDFPoint!, page_num: Int32) -> PTPDFPoint!

    Parameters

    page_num

    the page number for the page used as the origin of the destination coordinate system. Negative values are used to represent the current page. Pages are indexed starting from one.

  • Converts a point from a coordinate system of a given page to a point on canvas.

    Declaration

    Objective-C

    - (PTPDFPoint *)ConvPagePtToCanvasPt:(PTPDFPoint *)pt page_num:(int)page_num;

    Swift

    func convPagePt(toCanvasPt pt: PTPDFPoint!, page_num: Int32) -> PTPDFPoint!

    Parameters

    page_num

    the page number for the page used as the origin of the destination coordinate system. Negative values are used to represent the current page. Pages are indexed starting from one.

  • Converts a point expressed in screen coordinates to a point on a given page.

    Declaration

    Objective-C

    - (PTPDFPoint *)ConvScreenPtToPagePt:(PTPDFPoint *)pt page_num:(int)page_num;

    Swift

    func convScreenPt(toPagePt pt: PTPDFPoint!, page_num: Int32) -> PTPDFPoint!

    Parameters

    page_num

    the page number for the page used as the origin of the destination coordinate system. Negative values are used to represent the current page. Pages are indexed starting from one.

  • Converts a point from a coordinate system of a given page to a point on screen. If PDFView is in a non-continous page view mode, and the page is not visible, the result is undefined.

    Declaration

    Objective-C

    - (PTPDFPoint *)ConvPagePtToScreenPt:(PTPDFPoint *)pt page_num:(int)page_num;

    Swift

    func convPagePt(toScreenPt pt: PTPDFPoint!, page_num: Int32) -> PTPDFPoint!

    Parameters

    page_num

    the page number for the page used as the origin of the destination coordinate system. Negative values are used to represent the current page. Pages are indexed starting from one.

  • Converts a PTPDFRect in PDF page coordinates to a CGRect in screen (PTPDFViewCtrl) coordinates.

    @returns The equivalent rectangle, in screen coordinates.

    Declaration

    Objective-C

    - (CGRect)PDFRectPage2CGRectScreen:(PTPDFRect *)pdfRect
                            PageNumber:(int)pageNumber;

    Swift

    func pdfRectPage2CGRectScreen(_ pdfRect: PTPDFRect!, pageNumber: Int32) -> CGRect

    Parameters

    pdfRect

    The rectangle in PDF coordinates

    pageNumber

    The page number that the rectangle is on.

  • Converts a CGRect in screen (PTPDFViewCtrl) coordinates to a PTPDFRect in PDF page coordinates.

    @returns The equivalent rectangle, in screen coordinates.

    Declaration

    Objective-C

    - (PTPDFRect *)CGRectScreen2PDFRectPage:(CGRect)cgRect
                                 PageNumber:(int)pageNumber;

    Swift

    func cgRectScreen2PDFRectPage(_ cgRect: CGRect, pageNumber: Int32) -> PTPDFRect!

    Parameters

    cgRect

    The rectangle in screen coordinates

    pageNumber

    The page number for which the returned coordinates should reference

  • Note

    to obtain a transformation matrix that maps screen coordinates to page coordinates, you can invert the device matrix. For example: @code Common::Matrix2D scr2page(pdfviewctrl.GetDeviceTransform()); scr2page.Inverse(); @endcode

    Declaration

    Objective-C

    - (PTMatrix2D *)GetDeviceTransform:(int)page_num;

    Swift

    func getDeviceTransform(_ page_num: Int32) -> PTMatrix2D!

    Parameters

    page_num

    same as for PTPDFViewCtrl.Conv???() methods.

    Return Value

    the device transformation matrix. The device transformation matrix maps the page coordinate system to screen (or device) coordinate system.

  • Returns the current canvas width.

    Declaration

    Objective-C

    - (double)GetCanvasWidth;

    Swift

    func getCanvasWidth() -> Double
  • Returns the current canvas height.

    Declaration

    Objective-C

    - (double)GetCanvasHeight;

    Swift

    func getCanvasHeight() -> Double
  • Declaration

    Objective-C

    - (BOOL)IsFinishedRendering:(BOOL)visible_region_only;

    Swift

    func isFinishedRendering(_ visible_region_only: Bool) -> Bool

    Parameters

    visible_region_only

    Specifies if the method refers only to currently visible content.

    Return Value

    true is the rendering thread finished rendering the view, false if the rendering is still in progress.

  • Cancels rendering in` progress. If PTPDFViewCtrl is not busy rendering the page, the function has no side effects.

    Declaration

    Objective-C

    - (void)CancelRendering;

    Swift

    func cancelRendering()
  • Redraws the contents of the buffer. Equivalent to Update:NO

    Declaration

    Objective-C

    - (void)Update;

    Swift

    func update()
  • Redraws the contents of the buffer.

    Declaration

    Objective-C

    - (void)Update:(_Bool)all;

    Swift

    func update(_ all: Bool)

    Parameters

    all

    if true, all of the rendered content is discarded and re-rendered; otherwise, only the visible region will be re-rendered.

  • Redraws the area covered with a given annotation.

    Declaration

    Objective-C

    - (void)UpdateWithAnnot:(PTAnnot *)annot page_num:(int)page_num;

    Swift

    func update(with annot: PTAnnot!, page_num: Int32)

    Parameters

    annot

    The annotation to update.

    page_num

    The page number on which the annotation is located.

  • Redraws the given area in the buffer.

    Declaration

    Objective-C

    - (void)UpdateWithRect:(PTPDFRect *)update;

    Swift

    func update(with update: PTPDFRect!)

    Parameters

    update

    The rectangle to update expressed in screen coordinates.

  • Redraws the given area covered by the given field. Useful when a field is connected to other fields.

    Declaration

    Objective-C

    - (void)UpdateWithField:(PTField *)field;

    Swift

    func update(with field: PTField!)

    Parameters

    field

    The field to update.

  • Helper function that will refresh annotation and/or field appearances if needed, and then render modified page areas, all based on the contents of the view_change parameter.

    Declaration

    Objective-C

    - (void)RefreshAndUpdate:(PTViewChangeCollection *)view_change;

    Swift

    func refreshAndUpdate(_ view_change: PTViewChangeCollection!)

    Parameters

    view_change

    contains all the updated fields and rectangles.

  • Renders content that requires rendering. May be called to resume rendering after CancelRendering.

    Declaration

    Objective-C

    - (void)RequestRendering;

    Swift

    func requestRendering()
  • Set the suggested memory size of the rendered content.

    PTPDFViewCtrl keeps off-screen content in order to achieve better viewing experience; however, this increases memory usage. By default, PTPDFViewCtrl will use 80% of available memory to render on-screen and off-screen content. The value set here will be overidden if PurgeMemory is called.

    Note

    If you want to minimize memory usage at the cost of viewing experience quality, you can set allowedMax to 0 and PTPDFViewCtrl will not keep any off-screen content. Also note that this function only controls the memory used to store rendered content not the entire memory footprint of the control.

    Declaration

    Objective-C

    - (void)SetRenderedContentBufferSize:(long)allowedMax;

    Swift

    func setRenderedContentBufferSize(_ allowedMax: Int)

    Parameters

    allowedMax

    the allowed heap memory usage in MB.

  • Removes all non-visible portions of document to reduce memory consumption. This will reset the value set via SetContentBufferSize back to the default of 80% of available memory.

    Suggested use is in response to a low memory warning. May slightly slow down the time to complete rendering.

    Declaration

    Objective-C

    - (void)PurgeMemory;

    Swift

    func purgeMemory()
  • Enables of disables caching of images, fonts, and other resources. Disabling caching can lower memory requirements at the expense of rendering speed.

    Declaration

    Objective-C

    - (void)SetCaching:(BOOL)enabled;

    Swift

    func setCaching(_ enabled: Bool)

    Parameters

    enabled

    if true caching is enabled, if false caching is disabled. @default by default caching is enabled

  • Sets the cache parameters of the page cache on disk (which caches content streams and mipmapped images) for this specific document. These parameters will override the default cache parameters. Note that if this function is called after the document has been rasterized, it has no effect.

    Declaration

    Objective-C

    + (void)SetViewerCache:(PTSDFDoc *)document
            max_cache_size:(unsigned long)max_cache_size
                   on_disk:(BOOL)on_disk;

    Swift

    class func setViewerCache(_ document: PTSDFDoc!, max_cache_size: UInt, on_disk: Bool)

    Parameters

    document

    The document whose settings will be modified

    max_cache_size

    The maximum size, in bytes, of the entire document’s page cache

    on_disk

    Whether or not to store the cache on disk

  • Specify the different thumbnail settings for the viewer.

    Declaration

    Objective-C

    - (void)SetupThumbnails:(BOOL)use_embedded
          generate_at_runtime:(BOOL)generate_at_runtime
               use_disk_cache:(BOOL)use_disk_cache
        thumb_max_side_length:(int)thumb_max_side_length
           max_abs_cache_size:(unsigned long)max_abs_cache_size
          max_perc_cache_size:(double)max_perc_cache_size;

    Swift

    func setupThumbnails(_ use_embedded: Bool, generate_at_runtime: Bool, use_disk_cache: Bool, thumb_max_side_length: Int32, max_abs_cache_size: UInt, max_perc_cache_size: Double)

    Parameters

    use_embedded

    Enables or disables using thumbnails embedded in the PDF document as a preview of the rendered page.

    generate_at_runtime

    Enables or disables generating thumbnails at runtime.

    use_disk_cache

    Enables or disables caching thumbnails in a temporary disk file.

    thumb_max_side_length

    The maximum size, in pixels, of a dimension of generated thumbnails.

    max_abs_cache_size

    The absolute maximum size on disk, in bytes, for the temporary thumbnail cache.

    max_perc_cache_size

    The maximum percentage of free disk space, in the range 0 - 1.0, that the cache can take up.

  • Clears the thumbnail cache.

    Declaration

    Objective-C

    - (void)ClearThumbCache;

    Swift

    func clearThumbCache()
  • Requests a thumbnail from the document, which is returned in the delegate method GotThumbAsync:(int)page_num thumbImage:(UIImage*)image;

    If there is no document set on the control, it will throw an exception.

    Declaration

    Objective-C

    - (void)GetThumbAsync:(int)page_num;

    Swift

    func getThumbAsync(_ page_num: Int32)
  • Cancels all outstanding thumbnail requests queued by GetThumbAsync:

    Declaration

    Objective-C

    - (void)CancelAllThumbRequests;

    Swift

    func cancelAllThumbRequests()
  • Declaration

    Objective-C

    - (int)GetPageCount;

    Swift

    func getPageCount() -> Int32

    Return Value

    the total number of pages in the document.

  • Updates the page layout withing the view. This function must be called
    after document page sequence is modified (such as when a page is being added to or removed from a document) or after changes to page dimensions (e.g. after a page is rotated or resized).

    Declaration

    Objective-C

    - (void)UpdatePageLayout;

    Swift

    func updatePageLayout()
  • Used to add extra vertical scroll space to the PDF scroll view (inner scroll view) when the keyboard would otherwise block the bottom of the document when editing interactive forms.

    Declaration

    Objective-C

    - (void)setExtraVerticalContent:(int)points;

    Swift

    func setExtraVerticalContent(_ points: Int32)
  • Will cause PTPDFViewCtrl to scroll the content so that the onscreen keyboard does not hide the content being edited. See FormFillTool.m in the standard libTools distribution for example usage.

    Declaration

    Objective-C

    - (void)keyboardWillShow:(NSNotification *)notification
        rectToNotOverlapWith:(CGRect)rect;

    Swift

    func keyboardWillShow(_ notification: Notification!, rectToNotOverlapWith rect: CGRect)

    Parameters

    notification

    The notification object returned by a UIKeyboardWillShowNotification notification.

    rect

    The rectangle, in screen coordinates, that the keyboard should not overlap with.

  • Will cause PTPDFViewCtrl to scroll the content so that the onscreen keyboard does not hide the content being edited. See FormFillTool.m in the standard libTools distribution for example usage.

    Declaration

    Objective-C

    - (void)keyboardWillShow:(NSNotification *)notification
        rectToNotOverlapWith:(CGRect)rect
                     topEdge:(CGFloat)topEdge;

    Swift

    func keyboardWillShow(_ notification: Notification!, rectToNotOverlapWith rect: CGRect, topEdge: CGFloat)

    Parameters

    notification

    The notification object returned by a UIKeyboardWillShowNotification notification.

    rect

    The rectangle, in screen coordinates, that the keyboard should not overlap with.

    topEdge

    The top screen coordinate above which the rectangle should not be scrolled under.

  • Will cause PTPDFViewCtrl to reset the scroll position after a call to keyboardWillShow:rectToNotOverlapWith.

    Declaration

    Objective-C

    - (void)keyboardWillHide:(NSNotification *)notification;

    Swift

    func keyboardWillHide(_ notification: Notification!)

    Parameters

    notification

    The notificaion object returned by a UIKeyboardWillHideNotification notification.

  • The zoomScale of PTPDFViewCtrl. This will return 1.0 except when the control is actively being scaled for example by a pinch gesture. To get/set the zoom level of the displayed PDF, use GetZoom and SetZoom.

    Declaration

    Objective-C

    - (double)zoomScale;

    Swift

    func zoomScale() -> Double
  • Requests action object to be executed by PTPDFViewCtrl. Action must belong to the document currently displayed in PTPDFViewCtrl.

    Declaration

    Objective-C

    - (void)ExecuteAction:(PTAction *)action;

    Swift

    func execute(_ action: PTAction!)

    Parameters

    action

    object that is to be executed.

  • Requests action object to be executed by PTPDFViewCtrl. Action must belong to the document currently displayed in PTPDFViewCtrl.

    Declaration

    Objective-C

    - (void)ExecuteActionWithActionParameter:(PTActionParameter *)action_param;

    Swift

    func executeAction(with action_param: PTActionParameter!)

    Parameters

    action_param

    Container for parameters used in handling various actions.

  • Sets if document is to be presented for a left-to-right or right-to-left language. Default is left-to-right.

    Declaration

    Objective-C

    - (void)SetRightToLeftLanguage:(BOOL)isRightToLeft;

    Swift

    func setRightToLeftLanguage(_ isRightToLeft: Bool)

    Parameters

    isRightToLeft

    true if language is right-to-left; false otherwise.

  • Declaration

    Objective-C

    - (BOOL)GetRightToLeftLanguage;

    Swift

    func getRightToLeftLanguage() -> Bool

    Return Value

    true if PTPDFViewCtrl is set to display a PDF with a right-to-left language; false otherwise.