PDFGenerator

public class PDFGenerator : PDFGeneratorProtocol, CustomStringConvertible

Factory to convert a single PDFDocument into a PDF file

This is one of the main classes used to interact with the framework.

The PDFGenerator is a stateful object which should be used exactly once per generator task.

INTERNAL VARS

  • Total page count used for displaying in rendered PDF

    Declaration

    Swift

    public var totalPages: Int
  • Relative value tracking progress

    Declaration

    Swift

    public let progress: Progress
  • Object acts as a delegate during the generation process

    Declaration

    Swift

    public var delegate: PDFGeneratorDelegate?
  • Enables the debugging mode, which will render additional visual information on different elements.

    Declaration

    Swift

    public var debug: Bool

PUBLIC INITS

  • Initializes the generator with a PDFDocument`.

    Declaration

    Swift

    public init(document: PDFDocument)

    Parameters

    document

    The document which will be used to create the PDF document file

PUBLIC FUNCS

  • Convenience method for generate(to:info:) without info

    Declaration

    Swift

    func generateURL(filename: String) throws -> URL
  • Convenience method for generate(to:info:) without info

    Declaration

    Swift

    func generate(to url: URL) throws
  • Generates PDF data and writes it to a temporary file at the given URL to.

    Throws

    PDFError if the calculations or rendering fails

    Declaration

    Swift

    func generate(to url: URL, info: PDFInfo?) throws

    Parameters

    to

    URL where file should be saved.

    info

    PDF file information

  • Convenience method for generateData(info:) without defining info

    Declaration

    Swift

    func generateData() throws -> Data
  • Generates PDF data and returns it

    Throws

    PDFError if the calculations or rendering fails

    Declaration

    Swift

    func generateData(info: PDFInfo?) throws -> Data

    Parameters

    info

    Metadata Information added to file

    Return Value

    PDF file data

  • Generate PDF Context from PDFCommands

    Throws

    PDFError if the calculations or rendering fails

    Declaration

    Swift

    func generatePDFContext(context: PDFContext) throws
  • Creates a list of container-object pairs which will be rendered.

    Throws

    PDFError if the calculations fail

    Declaration

    Swift

    func createRenderObjects() throws -> [PDFLocatedRenderObject]

    Return Value

    List of renderable objects