PDFDocument

public class PDFDocument : CustomStringConvertible

This object holds the information about the document and also all PDF objects.

This is the main structure to create new documents. It is the base for the PDFGenerator to generate the PDF output

PUBLIC VARS

PUBLIC INITIALIZERS

Layout

  • Adds a empty space in the given container, between the previous and the next element

    Declaration

    Swift

    public func add(_ container: PDFContainer = PDFContainer.contentLeft, space: CGFloat)

    Parameters

    container

    Container where the space will be set

    space

    Space distance in points

Lines

  • Adds a horizontal line spearator to the given container. The line starts at the left indentation and ends at the right indentation. Customize by adjusting parameter style.

    Declaration

    Swift

    public func addLineSeparator(_ container: PDFContainer = PDFContainer.contentLeft, style: PDFLineStyle)

    Parameters

    container

    Container where the space will be set

    style

    Style of line

Image

  • Adds an image to the given container.

    Declaration

    Swift

    public func add(_ container: PDFContainer = PDFContainer.contentLeft, image: PDFImage)

    Parameters

    container

    Container where the space will be set

    image

    Image object

  • Adds an image row to the given container. This image row will fill the full available width between left indentation and right indentation.

    Declaration

    Swift

    public func add(_ container: PDFContainer = PDFContainer.contentLeft, imagesInRow images: [PDFImage], spacing: CGFloat = 5.0)

    Parameters

    container

    Container where the space will be set

    images

    Array of images, from left to right

    spacing

    Horizontal distance between images

Text

  • Shorthand public function to add a String text to the given container

    Declaration

    Swift

    public func add(_ container: PDFContainer = PDFContainer.contentLeft, text: String, lineSpacing: CGFloat = 1.0)

    Parameters

    container

    Container where the space will be set

    images

    Array of images, from left to right

    spacing

    Horizontal distance between images

  • Adds an text object to the given container

    Declaration

    Swift

    public func add(_ container: PDFContainer = PDFContainer.contentLeft, textObject: PDFSimpleText)

    Parameters

    container

    Container where the space will be set

    textObject

    Simple text object

  • Shorthand public function to add a attributed String text to the given container

    Declaration

    Swift

    public func add(_ container: PDFContainer = PDFContainer.contentLeft, attributedText: NSAttributedString)

    Parameters

    container

    Container where the space will be set

    text

    An attributed string

  • Adds an attributed text object to the given container

    Declaration

    Swift

    public func add(_ container: PDFContainer = PDFContainer.contentLeft, attributedTextObject: PDFAttributedText)

    Parameters

    container

    Container where the space will be set

    textObject

    Attributed text object

  • Set font in given container. This text color will be used when adding a PDFSimpleText

    Declaration

    Swift

    public func set(_ container: PDFContainer = PDFContainer.contentLeft, font: Font)

    Parameters

    container

    Container where the font will be set

    font

    Font of text

  • Reset text color in given container to default.

    Declaration

    Swift

    public func resetFont(_ container: PDFContainer = PDFContainer.contentLeft)

    Parameters

    container

    Container whose text color will be reset

  • Set text color in given container. This text color will be used when adding a PDFSimpleText

    Declaration

    Swift

    public func set(_ container: PDFContainer = PDFContainer.contentLeft, textColor: Color)

    Parameters

    container

    Container where the text color will be set

    color

    Color of the text

  • Reset text color in given container to default.

    Declaration

    Swift

    public func resetTextColor(_ container: PDFContainer = PDFContainer.contentLeft)

    Parameters

    container

    Container whose text color will be reset

Table

  • Adds a table object to the document in the defined container

    Declaration

    Swift

    public func add(_ container: PDFContainer = PDFContainer.contentLeft, table: PDFTable)

    Parameters

    container

    Container where the table color will be added

    color

    Table to add to document

List

  • Adds a list object to the document in the defined container

    Declaration

    Swift

    public func add(_ container: PDFContainer = PDFContainer.contentLeft, list: PDFList)

    Parameters

    container

    Container where the text color will be set

    color

    Color of the text

Section

  • Adds a section object to the document

    Declaration

    Swift

    public func add(section: PDFSection)

    Parameters

    section

    Section

Layout

  • Change the indentation in a container, use the parameter left to define from which side.

    Declaration

    Swift

    public func set(_ container: PDFContainer = PDFContainer.contentLeft, indent: CGFloat, left: Bool)

    Parameters

    container

    Container whose indentation should be changed

    indent

    Points from the side

    left

    If true then the left side indentation is set, else the right indentation is set

  • Change the absolute top offset in a container

    Declaration

    Swift

    public func set(_ container: PDFContainer = PDFContainer.contentLeft, absoluteOffset: CGFloat)

    Parameters

    container

    Container whose current absoilute offset should be changed

    absoluteOffset

    Points from the top

  • Creates a new page by adding a page break object

    Declaration

    Swift

    public func createNewPage()
  • Adds a new style to the list of known styles

    Declaration

    Swift

    public func add(style: PDFTextStyle) -> PDFTextStyle

    Parameters

    style

    Definition of the text style

  • Adds a table of content

    Declaration

    Swift

    public func add(tableOfContent: PDFTableOfContent)

    Parameters

    tableOfContent

    Options of the table of content

Column Wrapping