Common

  • This class handles opening URLs for other applications and coordinates access to the network indicator manager since this is restricted in an iOS extension case.

    See more

    Declaration

    Objective-C

    @protocol PSPDFApplication <NSObject>

    Swift

    protocol PSPDFApplication : NSObjectProtocol
  • Represents a certain view state (document position, zoom) of a PSPDFDocument.

    Note

    Important: If an instance of this class has a viewPort, that view port is always defined in the coordinate system of the page. For pages that are rotated by ± 90 degrees, this implies that the aspect ratio of the viewPort will appear to be “flipped” compared to the UI.
    See more

    Declaration

    Objective-C

    
    @interface PSPDFViewState : PSPDFModel <NSSecureCoding>

    Swift

    class PSPDFViewState : PSPDFModel, NSSecureCoding
  • The PSPDFDocument class represents a set of PDF sources that are displayed as one document.

    The PDF sources are internally represented as PSPDFDataProvider objects. The typical use case is to initialize the document with a single fileURL, which creates an implicit PSPDFCoordinatedFileDataProvider by default. You can also opt to use NSData or custom PSPDFDataProviders as sources during initialization.

    This object can be created on any thread. Accessing properties is thread safe but might take some time, as the underlying PDF documents need to be processed to fetch data like pageCount or title. The document builds an internal cache, so subsequent access is faster. For this reason, ensure that document objects are not created/destroyed randomly for maximum efficiency.

    Ensure that a PSPDFDocument is only opened by one PSPDFViewController at any time. Also ensure that subclasses do not implement their own equality semantics, and instead use the UID property to check if two documents are equal.

    PSPDFDocument supports NSFastEnumeration by enumerating over its documentProviders. The document providers are internal wrappers around the PSPDFDataProviders created during initialization.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFDocument
        : NSObject <PSPDFDocumentProviderDelegate, PSPDFOverridable, NSCopying,
                    NSSecureCoding, NSFastEnumeration, PSPDFileCoordinationDelegate>

    Swift

    class PSPDFDocument : NSObject, PSPDFDocumentProviderDelegate, PSPDFOverridable, NSCopying, NSSecureCoding, NSFastEnumeration, PSPDFileCoordinationDelegate
  • A PSPDFDocument consists of one or multiple PSPDFDocumentProvider‘s. Each document provider has exactly one data source (file/data/dataProvider) - note: This class is used within PSPDFDocument and should not be instantiated externally.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFDocumentProvider : NSObject

    Swift

    class PSPDFDocumentProvider : NSObject
  • Delegate for writing annotations.

    See more

    Declaration

    Objective-C

    @protocol PSPDFDocumentProviderDelegate <NSObject>

    Swift

    protocol PSPDFDocumentProviderDelegate : NSObjectProtocol
  • Wraps file system calls. Internal class cluster. Can be replaced with Enterprise SDK wrappers like Good Technology or MobileIron AppConnect.

    See more

    Declaration

    Objective-C

    @protocol PSPDFFileManager <NSObject>

    Swift

    protocol PSPDFFileManager : NSObjectProtocol
  • Coordinates file presenters and notifications. Observed presenters are automatically unregistered in response to UIApplicationDidEnterBackgroundNotification notification.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFFilePresenterCoordinator : NSObject

    Swift

    class PSPDFFilePresenterCoordinator : NSObject
  • An abstract base class for model objects, using reflection to provide sensible default behaviors.

    The default implementations of , -hash, and -isEqual: make use of the +propertyKeys method.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFModel : NSObject <NSCopying>

    Swift

    class PSPDFModel : NSObject, NSCopying
  • Allows to override specific subclasses of a controller/view/model.

    See more

    Declaration

    Objective-C

    @protocol PSPDFOverridable <NSObject>

    Swift

    protocol PSPDFOverridable : NSObjectProtocol
  • Represents PDF page data. Managed within PSPDFDocumentProvider.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFPageInfo : NSObject <NSCopying, NSSecureCoding>

    Swift

    class PSPDFPageInfo : NSObject, NSCopying, NSSecureCoding
  • The PDF render manager coordinates the PDF renderer used.

    See more

    Declaration

    Objective-C

    @protocol PSPDFRenderManager <NSObject>

    Swift

    protocol PSPDFRenderManager : NSObjectProtocol
  • The render queue is responsible for scheduling and completing tasks. Typically you don’t create your own render queue but instead use the render queue provided by the render manager. Creating your own render queue is possible but due to internal resource constraints will almost never speed up rendering but instead the queues try to access the same resources and then need to wait until the resource becomes available.

    The goal of the render queue is to keep the average time it takes to complete a render task at a minimum. To achive this the render queue intelligently schedules and bundles tasks. Therefore the order in which scheduled tasks are executed is undefined and depends on many factors.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFRenderQueue : NSObject

    Swift

    class PSPDFRenderQueue : NSObject
  • A render request specifies the exact parameters of how an image should be rendered. You use it in order to configure a PSPDFRenderTask which can then be passend to a PSPDFRenderQueue in order to fulfill the task.

    To create a new render request you usually create a PSPDFMutableRenderRequest and set the properties you need.

    Thread safety

    PSPDFRenderRequest is not thread safe, you should never modify a mutable render request from multiple threads nor should you modify a mutable render request while reading data from it on a different thread.

    As soon as you hand over ownership of a render request to the render engine, it is copied, so that you do not need to worry about thread safety between your render requests and the ones the render engine holds.

    See

    PSPDFRenderTask

    See

    PSPDFMutableRenderRequest
    See more

    Declaration

    Objective-C

    
    @interface PSPDFRenderRequest : NSObject <NSCopying, NSMutableCopying>

    Swift

    class PSPDFRenderRequest : NSObject, NSCopying, NSMutableCopying
  • A render task is used to create an image from the page (or part of it) of a document.

    Depending on the PSPDFRenderRequest cache policy, a render task checks the cache before actually triggering a new rendering.

    You create a render task by passing it an instance of PSPDFRenderRequest. Once you have created a render request make sure to fully set it up before scheduling it in a render queue.

    A simple example of requesting an image from a page:

    PSPDFMutableRenderRequest *request = [[PSPDFMutableRenderRequest alloc] initWithDocument:document];
    request.pageIndex = pageIndex;
    request.imageSize = CGSizeMake(320.0f, 480.0f);
    
    PSPDFRenderTask *task = [[PSPDFRenderTask alloc] initWithRequest:request];
    task.priority = PSPDFRenderQueuePriorityUtility;
    task.delegate = self;
    
    [PSPDFKit.sharedInstance.renderManager.renderQueue scheduleTask:task];
    
    let request = PSPDFMutableRenderRequest(document: document)
    request.pageIndex = 0
    request.imageSize = CGSize(width: 320.0, height: 480.0)
    
    let task = PSPDFRenderTask(request: request)!
    task.priority = .utility
    task.delegate = self
    
    PSPDFKit.sharedInstance.renderManager.renderQueue.schedule(task)
    
    See more

    Declaration

    Objective-C

    
    @interface PSPDFRenderTask : NSObject

    Swift

    class PSPDFRenderTask : NSObject