PDFGenerator
public class PDFGenerator
Factory which converts a document into a PDF file
-
Total page count used for displaying in rendered PDF
Declaration
Swift
public var totalPages: Int
-
Initializes the generator with a document.
Declaration
Swift
public init(document: PDFDocument)
Parameters
document
The document which will be converted
-
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
-
Generate PDF Context from PDFCommands
Throws
PDFError
Declaration
Swift
public func generatePDFContext(progress: ((CGFloat) -> Void)?) throws
Parameters
progress
Optional closure for progress handling. Parameter is between 0.0 and 1.0
-
Creates a list of container-object pairs which will be rendered.
Declaration
Swift
public func createRenderObjects(progress: ((CGFloat) -> Void)?) throws -> [(PDFContainer, PDFObject)]
Return Value
List of renderable objects