Common

  • Use PSPDFKitError instead.

    Declaration

    Swift

    @available(*, deprecated, renamed: "PSPDFKitError", message: "Deprecated in PSPDFKit 9.4 for iOS and 4.4 for macOS.")
    public typealias PSPDFError = PSPDFKitError
  • Annotates a class that can be overriden with a more specific subclass.

    Declaration

    Objective-C

    @protocol PSPDFOverridable <NSObject>

    Swift

    protocol Overridable : NSObjectProtocol
  • Used for various configuration options.

    See

    PSPDFConfiguration
    See more

    Declaration

    Objective-C

    
    @interface PSPDFBaseConfiguration<
        BuilderType : __kindof PSPDFBaseConfigurationBuilder *> : PSPDFModel

    Swift

    class BaseConfiguration<BuilderType> : ModelObject where BuilderType : BaseConfigurationBuilder
  • PSPDFKit - The Leading PDF Framework for iOS, Android and the Web. This is the configuration object for framework-global settings.

    Note

    The PSPDFKit shared object is a global, thread-safe key/value store. Use setValue:forKey: and valueForKey: or the subscripted variants to set/get properties.

    Subclassing notes: In PSPDFKit various classes can be subclassed and registered as subclasses via overrideClass:withClass: on Document (model) and PDFConfiguration (view/controller). See https://pspdfkit.com/guides/ios/current/getting-started/overriding-classes/ for details.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFKitGlobal : NSObject

    Swift

    class SDK : NSObject
  • An angle a PDF page is displayed at in clockwise degrees.

    See more

    Declaration

    Objective-C

    enum PSPDFRotation {}

    Swift

    @frozen enum Rotation : UInt
  • The Document 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.

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

    Note

    Not all state is archived with NSCoder.

    Note

    Ensure that a Document is only opened by one PDFViewController 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.

    See more

    Declaration

    Objective-C

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

    Swift

    class Document : NSObject, DocumentProviderDelegate, Overridable, NSCopying, NSSecureCoding, NSFastEnumeration, FileCoordinationDelegate
  • Delegate to receive events regarding Document.

    This delegate offers callbacks for custom actions after save events.

    See more

    Declaration

    Objective-C

    @protocol PSPDFDocumentDelegate <NSObject>

    Swift

    protocol PDFDocumentDelegate : NSObjectProtocol
  • A Document consists of one or multiple PSPDFDocumentProvider‘s. Each document provider has exactly one data source (file/data/dataProvider)

    Note

    This class is used within Document and should not be instantiated externally.
    See more

    Declaration

    Objective-C

    
    @interface PSPDFDocumentProvider : NSObject <PSPDFOverridable>

    Swift

    class PDFDocumentProvider : NSObject, Overridable
  • Delegate for writing annotations.

    See more

    Declaration

    Objective-C

    @protocol PSPDFDocumentProviderDelegate <NSObject>

    Swift

    protocol DocumentProviderDelegate : 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
  • PSPDFDocumentFeatures provides the main interface for querying features and registering observers.

    It conforms to PSPDFDocumentFeaturesSource itself, but additionally to the document features source protocol it also guarantees that it implements all methods of this protocol. Therefore it is save to query every feature on an instance of this class without checking its availability for.

    Usually you access this class through Document‘s features property. So if you, for example, want to check if a document can be modified, you can check document.features.canModify.

    See

    -[PSPDFDocument features]

    Threading

    PSPDFDocumentFeatures is thread safe and can be used from any thread. This also means that your custom sources will be called from various threads and queues. Do not rely on being called on a particular thread in your custom sources.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFDocumentFeatures : NSObject <PSPDFDocumentFeaturesSource>

    Swift

    class PDFDocumentFeatures : NSObject, PDFDocumentFeaturesSource
  • A Document subclass that can be used to display and annotate image files. Can handle JPEG and PNG images.

    Note

    Any transparency on PNG images will be lost after saving.

    Saving changes flattens any annotations into the image and writes it back to the original file. Creating a new document will then reflect the new image with flattened changes. Keep the image document in memory to preserve the ability to edit added annotations.

    See https://pspdfkit.com/guides/ios/current/annotations/annotate-images/ for more information.

    Note

    PSPDFImageDocument requires the Image Documents feature to be enabled for your license to work.
    See more

    Declaration

    Objective-C

    
    @interface PSPDFImageDocument : PSPDFDocument

    Swift

    class ImageDocument : Document
  • 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 FileManager : 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 FilePresenterCoordinator : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    NS_CLOSED_ENUM(NSInteger, PSPDFPageBinding) {
        PSPDFPageBindingUnknown,
        PSPDFPageBindingLeftEdge,
        PSPDFPageBindingRightEdge,
    }

    Swift

    @frozen enum PSPDFPageBinding : Int
  • Represents PDF page data. Managed within PSPDFDocumentProvider.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFPageInfo : NSObject <NSCopying, NSSecureCoding>

    Swift

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

    See more

    Declaration

    Objective-C

    @protocol PSPDFRenderManager <NSObject>

    Swift

    protocol RenderManager : NSObjectProtocol
  • Defines the options to apply when rendering PDF pages, such as color inversion, filters, colors and annotation behavior.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFRenderOptions : PSPDFModel <NSSecureCoding>

    Swift

    class RenderOptions : ModelObject, NSSecureCoding
  • 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 achieve 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 RenderQueue : 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 RenderRequest : 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.0, 480.0);
    
    PSPDFRenderTask *task = [[PSPDFRenderTask alloc] initWithRequest:request];
    task.priority = PSPDFRenderQueuePriorityUtility;
    task.delegate = self;
    
    [PSPDFKitGlobal.sharedInstance.renderManager.renderQueue scheduleTask:task];
    
    let request = MutableRenderRequest(document: document)
    request.pageIndex = 0
    request.imageSize = CGSize(width: 320.0, height: 480.0)
    
    let task = RenderTask(request: request)!
    task.priority = .utility
    task.delegate = self
    
    SDK.shared.renderManager.renderQueue.schedule(task)
    
    See more

    Declaration

    Objective-C

    
    @interface PSPDFRenderTask : NSObject

    Swift

    class RenderTask : 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 Documents, 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 Document.
    See more

    Declaration

    Objective-C

    
    @interface PSPDFDocumentCheckpointer : NSObject

    Swift

    class DocumentCheckpointer : NSObject
  • Represents a possible destination directory.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFDirectory : PSPDFModel <NSSecureCoding>

    Swift

    class Directory : ModelObject, NSSecureCoding