PSPDFKit


@interface PSPDFKit : NSObject <PSPDFSettings>

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 PSPDFDocument (model) and PSPDFConfiguration (view/controller). See https://pspdfkit.com/guides/ios/current/getting-started/overriding-classes/ for details.

  • The shared PSPDFKit configuration instance. - note: This is the default instance used in document and pdf controller instances.

    Declaration

    Objective-C

    @property (readonly, atomic, class) PSPDFKit *_Nonnull sharedInstance;

    Swift

    class var sharedInstance: PSPDFKit { get }
  • Activate PSPDFKit with your license key from https://customers.pspdfkit.com

    Declaration

    Objective-C

    + (void)setLicenseKey:(nonnull NSString *)licenseKey;

    Swift

    class func setLicenseKey(_ licenseKey: String)
  • Activate PSPDFKit with your license key from https://customers.pspdfkit.com Variant that may be used to set options. These can also later be changed via subscripting access.

    Declaration

    Objective-C

    + (void)setLicenseKey:(nonnull NSString *)licenseKey
                  options:(nullable NSDictionary<NSString *, id> *)options;

    Swift

    class func setLicenseKey(_ licenseKey: String, options: [String : Any]? = nil)
  • Returns the full PSPDFKit product version string (e.g. PSPDFKit 7.0.0 for iOS (70000))

    Declaration

    Objective-C

    @property (readonly, atomic, class) NSString *_Nonnull versionString;

    Swift

    class var versionString: String { get }
  • Returns just the framework version. (e.g. 6.0.0)

    Declaration

    Objective-C

    @property (readonly, atomic, class) NSString *_Nonnull versionNumber;

    Swift

    class var versionNumber: String { get }
  • Returns the PSPDFKit version date.

    Declaration

    Objective-C

    @property (readonly, atomic, class) NSDate *_Nonnull compiledAt;

    Swift

    class var compiledAt: Date { get }
  • The internal build number. Increments with every version.

    Declaration

    Objective-C

    @property (readonly, atomic, class) NSUInteger buildNumber;

    Swift

    class var buildNumber: UInt { get }
  • Tests for specific features. Can test multiple features at once via the bit mask.

    Declaration

    Objective-C

    + (BOOL)isFeatureEnabled:(PSPDFFeatureMask)feature;

    Swift

    class func isFeatureEnabled(_ feature: PSPDFFeatureMask) -> Bool
  • Allow direct dictionary-like access. The key must be of type NSString.

    Declaration

    Objective-C

    - (void)setObject:(nonnull id)object
        forKeyedSubscript:(nonnull id<NSCopying>)key;

    Swift

    func setObject(_ object: Any, forKeyedSubscript key: NSCopying)
  • The shared memory/file cache.

    Declaration

    Objective-C

    @property (readonly, nonatomic) PSPDFCache *_Nonnull cache;

    Swift

    var cache: PSPDFCache { get }
  • The common file manager object.

    Declaration

    Objective-C

    @property (readonly, nonatomic) id<PSPDFFileManager> _Nonnull fileManager;
  • The PDF render coordinator.

    Declaration

    Objective-C

    @property (readonly, nonatomic) id<PSPDFRenderManager> _Nonnull renderManager;
  • The annotation style manager.

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        id<PSPDFAnnotationStyleManager> _Nonnull styleManager;
  • The shared signature handler for digital signature management.

    Declaration

    Objective-C

    @property (readonly, nonatomic) PSPDFSignatureManager *_Nonnull signatureManager;

    Swift

    var signatureManager: PSPDFSignatureManager { get }
  • Controls various security-related aspects and allows enabling/disabling features based on the security settings.

    Declaration

    Objective-C

    @property (readonly, nonatomic) id<PSPDFApplicationPolicy> _Nonnull policy;
  • The default library. You can override this property to use a custom PSPDFLibrary as the default library. It is recommended that you do this early in your application launch. Defaults to an unencrypted library by default or to nil if the FTS feature is not enabled in the license.

    If you want to change the indexing priority of the library, set the PSPDFLibraryIndexingPriorityKey in the options dictionary passed into +[PSPDFKit setLicenseKey:options:].

    Declaration

    Objective-C

    @property (assign, readwrite, atomic, nullable) PSPDFLibrary *library;

    Swift

    var library: PSPDFLibrary? { get set }
  • An encryption provider for databases. Defaults to nil. You must set this property before using any database encryption features. See PSPDFDatabaseEncryptionProvider for more information on how to implement this.

    Declaration

    Objective-C

    @property (assign, readwrite, atomic, nullable)
        id<PSPDFDatabaseEncryptionProvider>
            databaseEncryptionProvider;
  • Various PSPDFKit objects require dependencies. Use this helper to automatically connect them. Will only set known objects that are not already set.

    Declaration

    Objective-C

    - (NSUInteger)injectDependentProperties:(nonnull id)object;

    Swift

    func injectDependentProperties(_ object: Any) -> UInt
  • PSPDFKit analytics instance. All PSPDFKit events are logged with this instance.

    Declaration

    Objective-C

    @property (readonly, nonatomic) PSPDFAnalytics *_Nonnull analytics;

    Swift

    var analytics: PSPDFAnalytics { get }
  • Loads images from the PSPDFKit.bundle.

    Note

    Calls imageLoadingHandler if one is set, else falls back to internal loading logic.

    Declaration

    Objective-C

    + (nullable UIImage *)imageNamed:(nonnull NSString *)name;

    Swift

    class func imageNamed(_ name: String) -> NSImage?
  • Register a custom block to return custom images. If this block is NULL or returns nil, PSPDFKit.bundle will use for the lookup. If your custom handler returns no image, the default lookup will be used as well.

    Note

    Images are cached, so don’t return different images for the same imageName during an app session. This was exposed as PSPDFSetBundleImageBlock in earlier versions.

    Declaration

    Objective-C

    @property (assign, readwrite, atomic, null_resettable) UIImage *_Nullable (^)
        (NSString *_Nonnull) imageLoadingHandler;

    Swift

    var imageLoadingHandler: ((String) -> NSImage?)! { get set }
  • Set the global PSPDFKit log level. Defaults to PSPDFLogLevelMaskInfo|PSPDFLogLevelMaskWarning|PSPDFLogLevelMaskError.

    Warning

    Setting this to PSPDFLogLevelMaskVerbose will severely slow down your application.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) PSPDFLogLevelMask logLevel;

    Swift

    var logLevel: PSPDFLogLevelMask { get set }
  • Custom log handler to forward logging to a different system.

    PSPDFKit uses os_log or falls back to NSLog on older OS versions (iOS 9) Setting this to NULL will reset the default behavior.

    Note

    Usage example: [PSPDFKit.sharedInstance setLogHandler:^(PSPDFLogLevelMask type, const char *tag, NSString *(^message)(void), const char *file, const char *function, NSUInteger line) { NSLog(@"PSPDFKit says from %s: %@", function, message()); }];

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, null_resettable) void (^)
        (PSPDFLogLevelMask, const char *_Nullable,
         NSString *_Nonnull (^_Nonnull)(void), const char *_Nonnull,
         const char *_Nonnull, NSUInteger) logHandler;

    Swift

    var logHandler: ((PSPDFLogLevelMask, UnsafePointer