Common

  • May be used to override specific subclasses of a controller/view/model.

    See more

    Declaration

    Objective-C

    @protocol PSPDFOverridable <NSObject>

    Swift

    protocol PSPDFOverridable : NSObjectProtocol
  • The PSPDFDocument class represents a set of PDF sources that are displayed as one document.

    The PDF sources are internally represented as data providers (implementations of the PSPDFDataProviding protocol). 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 implementations of PSPDFDataProviding 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 data providers created during initialization.

    See more

    Declaration

    Objective-C

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

    Swift

    class PSPDFDocument : NSObject, PSPDFDocumentProviderDelegate, PSPDFOverridable, NSCopying, NSSecureCoding, NSFastEnumeration, PSPDFFileCoordinationDelegate
  • 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
  • This class describes the security options you want to use when saving a PDF file. Using a security options object overrides the default options of a file.

    A PDF file can have multiple security-related options set. The owner password generally controls the editing of a document and is required as soon as you want to encrypt a document of any kind. The user password prevents users from viewing the PDF. It is optional but if you specify it you also need to specify an owner password.

    You can also specify the key length of the encryption. This controls how large the key is that is used for actually encrypting the document. The key is derived from the passwords you specify. As soon as you specify at least an owner password you also need to decide on a key length to be used. You can also specify PSPDFDocumentSecurityOptionsKeyLengthAutomatic in all cases and let PSPDFKit decide on if and what key length to use.

    To specify what operations are allowed when opening the document with user privileges you can also set PSPDFDocumentPermissions. With user privileges you can always view the file in question and by specifying PSPDFDocumentPermissions you can grant further rights that otherwise would only be available when the user has owner privileges.

    PSPDFKit supports two encryption algorithms: RC4 and AES. RC4 is a proprietary encryption algorithm of RSA Security Inc. It is a symmetric stream cipher, ie. the same algorithm is used for both encryption and decryption, and the algorithm does not change the length of the data. AES support was introduced with PDF 1.6. It is a symmetric block cipher, ie. the same algorithm is used for both encryption and decryption, and the length of the data when encrypted is rounded up to a multiple of the block size, which is fixed in this implementation to always be 16 bytes.

    Note

    In order to use this class, you need a license that enables you to use the Document Editor. If you want to process a file while keeping the options of the original file, simply pass nil for security options.
    See more

    Declaration

    Objective-C

    
    @interface PSPDFDocumentSecurityOptions : NSObject

    Swift

    class PSPDFDocumentSecurityOptions : NSObject
  • The PDF Page represents a page of a document. The document is strongly retained.

    Responsibilities:

    • Make working with annotations simpler.
    See more

    Declaration

    Objective-C

    
    @interface PSPDFPage : NSObject

    Swift

    class PSPDFPage : NSObject
  • 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
  • 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
  • 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
  • A checkpointer handles autosaving of annotations for recovery in case of a crash that occurs without saving. A checkpoint is a small file that contains all the changes made to the document that haven’t been saved. The checkpoint is created according to the strategy. On a save of the document, it is automatically deleted.

    Note

    Checkpoints are not supported for multi-provider PSPDFDocuments, or documents that are encrypted.

    Note

    This class is thread safe.

    Note

    You must not create instances of this class yourself, and instead use the checkpointer property on PSPDFDocument.
    See more

    Declaration

    Objective-C

    
    @interface PSPDFDocumentCheckpointer : NSObject

    Swift

    class PSPDFDocumentCheckpointer : NSObject
  • 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