PDFElement
protocol PDFElement
A protocol for elements to create a PDF page from a Song
-
shoudPageBreak(rect:
Default implementationpageRect: ) Check if a
PDFElement
fits on the current page or if it should breakDefault Implementation
Check if a
PDFElement
fits on the current page or if it should breakDeclaration
Swift
func shoudPageBreak(rect: CGRect, pageRect: CGRect) -> Bool
Parameters
rect
The available rectangle
Return Value
Bool if the page should break
-
draw(rect:
Default implementationcalculationOnly: pageRect: ) Draw the
PDFElement
Default Implementation
Draw the
PDFElement
Declaration
Swift
func draw(rect: inout CGRect, calculationOnly: Bool, pageRect: CGRect)
Parameters
rect
The available rectangle
calculationOnly
Bool if only the Bounding Rect should be calculated
pageRect
The size of the page
-
calculateDraw(rect:
Default implementationelements: pageRect: ) Calculate the Rect Bounds for an
PDFElement
arrayDefault Implementation
Calculate the Rect Bounds for an
PDFElement
arrayDeclaration
Swift
func calculateDraw(rect: CGRect, elements: [PDFElement], pageRect: CGRect) -> CGRect
Parameters
rect
The available rectangle
elements
The
PDFElement
arrayReturn Value
The available rectangle after the drawing
-
stringToMarkdown(_:
Default implementation) Convert a string into Markdown
Default Implementation
Convert a string into Markdown
Declaration
Swift
func stringToMarkdown(_ text: String) -> NSAttributedString
Parameters
text
The text as String
Return Value
The Markdown text as
NSAttributedString
-
textPadding
Extension methodThe default padding for text
Note
Static because it is used in initsDeclaration
Swift
var textPadding: CGFloat
-
textDrawingOptions
Extension methodThe default text drawing options
Declaration
Swift
var textDrawingOptions: NSString.DrawingOptions
-
padding(_:
Extension method) Add padding to a
PDFElement
Declaration
Swift
func padding(_ size: CGFloat) -> PDFElement
Parameters
size
The size of the padding
Return Value
A modified
PDFElement
-
clip(_:
Extension method) Add a clip shape around a
PDFElement
Declaration
Swift
func clip(_ shape: PDFBuild.ShapeStyle) -> PDFElement
Parameters
shape
The style of the shape
Return Value
A modified
PDFElement