PSPDFProcessor


@interface PSPDFProcessor : NSObject

Create, merge or modify PDF documents. Can also flatten annotation data.

  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, weak) id<PSPDFProcessorDelegate> delegate

    Swift

    weak var delegate: PSPDFProcessorDelegate? { get set }
  • Instantiates a PSPDFProcessor with the given configuration and security options.

    See

    -initWithOptions: if you want to generate a PDF from an HTML string or URL.

    Declaration

    Objective-C

    - (nonnull instancetype)
        initWithConfiguration:(nonnull PSPDFProcessorConfiguration *)configuration
              securityOptions:
                  (nullable PSPDFDocumentSecurityOptions *)securityOptions;

    Swift

    init(configuration: PSPDFProcessorConfiguration, securityOptions: PSPDFDocumentSecurityOptions?)

    Parameters

    configuration

    The configuration you want to use for the processing.

    securityOptions

    The save options to use or nil if you want to keep the ones from the original document.

    Return Value

    PSPDFProcessor instance.

  • Generates a new document based on the configuration and security options set on the receiver, and stores it to fileURL.

    Declaration

    Objective-C

    - (BOOL)writeToFileURL:(nonnull NSURL *)fileURL
                     error:(NSError *_Nullable *_Nullable)error;

    Swift

    func write(toFileURL fileURL: URL) throws

    Parameters

    fileURL

    The URL to save the generated document to. Needs to be a file URL.

    error

    On return, contains an error if one occurred while generating the document.

    Return Value

    YES if generation was successful, NO otherwise.

  • Generates a new document based on the configuration and security options set on the receiver.

    Note

    The data object will be memory-mapped if possible, however we encourage you to use the file url based variant instead.

    Declaration

    Objective-C

    - (nullable NSData *)dataWithError:(NSError *_Nullable *_Nullable)error;

    Swift

    func data() throws -> Data

    Parameters

    error

    On return, contains an error if one occurred while generating the document.

    Return Value

    An NSData object containing the generated document. If possible, this object is memory-mapped.

  • Generates a new document based on the configuration and security options set on the receiver, and writes it to the PSPDFDataSink provided.

    Declaration

    Objective-C

    - (BOOL)outputToDataSink:(nonnull id<PSPDFDataSink>)outputDataSink
                       error:(NSError *_Nullable *_Nullable)error;

    Swift

    func output(to outputDataSink: PSPDFDataSink) throws

    Parameters

    outputDataSink

    The generated document will be written into outputDataSink.

    error

    On return, contains an error if one occurred while generating the document.

    Return Value

    YES if generation was successful, NO otherwise.

  • Cancels the current PDF generation process associated with the receiver.

    The cancellation is asynchronous, and only happens until the current page that’s being processes is completed.

    Declaration

    Objective-C

    - (void)cancel;

    Swift

    func cancel()
  • Cancel all ongoing conversion operations.

    Declaration

    Objective-C

    + (void)cancellAllConversionOperations;

    Swift

    class func cancellAllConversionOperations()