ExportSong

enum ExportSong

Functions to export a song to PDF

  • The width of the SwiftUI Views

    Declaration

    Swift

    static let pageWidth: Double
  • The render scale for the ImageRenderer

    Declaration

    Swift

    static let rendererScale: Double
  • Create a PDF file of the song

    Declaration

    Swift

    @MainActor
    static func createPDF(song: Song) -> NSData?

    Parameters

    song

    The song

    Return Value

    The song as NSData

  • Write the PDF to disk

    Declaration

    Swift

    @MainActor
    static func savePDF(song: Song)

    Parameters

    song

    The song

  • Merge all the parts into pages

    See more

    Declaration

    Swift

    private static func mergeParts(header: CGImage, parts: [CGImage]) -> [SWIFTImage]

    Parameters

    header

    The header of the song

    parts

    The parts of the song

    Return Value

    An array of NSImage

  • Create a PDF from the pages

    Declaration

    Swift

    private static func pages2pdf(pages: [SWIFTImage]) -> NSData?

    Parameters

    pages

    The pages of the song

    Return Value

    A PDF as NSData

  • Render the header of the song

    Declaration

    Swift

    @MainActor
    static func renderHeader(song: Song) -> CGImage?

    Parameters

    song

    The song

    Return Value

    The header as CGImage

  • Render the chords of the song

    Declaration

    Swift

    @MainActor
    static func renderChords(song: Song) -> CGImage?

    Parameters

    song

    The song

    Return Value

    The header as CGImage

  • Render all the parts of the song

    See more

    Declaration

    Swift

    @MainActor
    static func renderParts(song: Song) -> [CGImage]

    Parameters

    song

    The song

    Return Value

    An array of CGImage