GSKPDF

@interface GSKPDF : NSObject

GSKPDF encapsulate the generation of a PDF document.

  • Write the given PDF document to the specified file path.

    This method will take some time, proportionally to the number of pages of the PDF document.

    Declaration

    Objective-C

    + (BOOL)generatePDFDocument:(nonnull GSKPDFDocument *)document
                         toPath:(nonnull NSString *)filePath
             withImageProcessor:(id<GSKPDFImageProcessor> _Nullable)processor
                          error:(NSError *_Nullable *_Nullable)error;

    Parameters

    document

    The PDF document.

    filePath

    The file path to write the PDF to.

    processor

    An object to preprocess each image before creating the corresponding page. For instance, you can inject a preprocessor to downsample the images.

    error

    On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

    Return Value

    YES if the PDF was generated successfully, NO if an error occured.

  • A convenience shorthand for the previous method with a processor that doesn’t apply any change to the images.

    Declaration

    Objective-C

    + (BOOL)generatePDFDocument:(nonnull GSKPDFDocument *)document
                         toPath:(nonnull NSString *)filePath
                          error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func generate(_ document: GSKPDFDocument, toPath filePath: String) throws