PDFGenerator

public class PDFGenerator

Factory which converts a document into a PDF file

  • Generates PDF data and writes it to a temporary file.

    Throws

    PDFError

    Declaration

    Swift

    public static func generateURL(document: PDFDocument, filename: String, progress: ((CGFloat) -> Void)? = nil, debug: Bool = false) throws -> URL

    Parameters

    document

    PDFDocument which should be converted into a PDF file.

    filename

    Name of temporary file.

    progress

    Optional closure for progress handling. Parameter is between 0.0 and 1.0

    debug

    Enables debugging

    Return Value

    URL to temporary file.

  • Generates PDF data and writes it to a temporary file.

    Throws

    PDFError

    Declaration

    Swift

    public static func generate(document: PDFDocument, to url: URL, progress: ((CGFloat) -> Void)? = nil, debug: Bool = false) throws

    Parameters

    document

    PDFDocument which should be converted into a PDF file.

    progress

    Optional closure for progress handling. Parameter is between 0.0 and 1.0

    debug

    Enables debugging

    Return Value

    URL to temporary file.

  • Generates PDF data and returns it

    Throws

    PDFError

    Declaration

    Swift

    public static func generateData(document: PDFDocument, progress: ((CGFloat) -> Void)? = nil, debug: Bool = false) throws -> Data

    Parameters

    document

    PDFDocument which should be converted into a PDF file.

    progress

    Optional closure for progress handling. Parameter is between 0.0 and 1.0

    debug

    Enables debugging

    Return Value

    PDF Data