-
-
Notifications
You must be signed in to change notification settings - Fork 133
Expand file tree
/
Copy pathHeaderFooterExampleFactory.swift
More file actions
40 lines (30 loc) · 1.53 KB
/
HeaderFooterExampleFactory.swift
File metadata and controls
40 lines (30 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//
// HeaderFooterExampleFactory.swift
// TPPDF
//
// Created by Philip Niedertscheider on 18.12.2019.
// Copyright © 2016-2025 techprimate GmbH. All rights reserved.
//
import Foundation
import TPPDF
class HeaderFooterExampleFactory: ExampleFactory {
func generateDocument() -> [PDFDocument] {
let document = PDFDocument(format: .a4)
// Add text to footer
document.add(.footerLeft, textObject: PDFSimpleText(text: "Footer Left 1"))
document.add(.footerLeft, textObject: PDFSimpleText(text: "Footer Left 2"))
document.add(.footerLeft, textObject: PDFSimpleText(text: "Footer Left 3"))
document.add(.footerRight, textObject: PDFSimpleText(text: "Footer Right 1"))
document.add(.footerRight, textObject: PDFSimpleText(text: "Footer Right 2"))
document.add(.footerRight, textObject: PDFSimpleText(text: "Footer Right 3"))
// Add text to header
document.add(.headerLeft, textObject: PDFSimpleText(text: "Header Left 1"))
document.add(.headerLeft, textObject: PDFSimpleText(text: "Header Left 2"))
document.add(.headerLeft, textObject: PDFSimpleText(text: "Header Left 3"))
document.add(.headerRight, textObject: PDFSimpleText(text: "Header Right 1"))
document.add(.headerRight, textObject: PDFSimpleText(text: "Header Right 2"))
document.add(.headerRight, textObject: PDFSimpleText(text: "Header Right 3"))
document.add(text: "Random text, otherwise the headers and footers won't be visible")
return [document]
}
}