Skip to content

Commit 42d171e

Browse files
committed
WIP
1 parent 40d9e47 commit 42d171e

File tree

96 files changed

+2345
-2136
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+2345
-2136
lines changed

Documentation/Usage.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ Also each cell can have a `margin` which is the distance between the cell frame
504504
document.add(table: table)
505505
```
506506

507-
## Multi-Column Sections
507+
### Multi-Column Sections
508508

509509
A multi-column section is a nested container. You create the section with an amount of columns and their relative width, add objects to each column and then add the whole section to the document.
510510

Shared/Examples/TableOfContentsExampleFactory.swift

+18-13
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,32 @@
77
//
88

99
#if os(iOS)
10-
import UIKit
10+
import UIKit
1111
#elseif os(macOS)
12-
import AppKit
12+
import AppKit
1313
#endif
1414
import TPPDF
1515

1616
class TableOfContentsExampleFactory: ExampleFactory {
17-
1817
func generateDocument() -> [PDFDocument] {
1918
let document = PDFDocument(format: .a4)
2019

2120
// Define doccument wide styles
22-
let titleStyle = document.add(style: PDFTextStyle(name: "Title",
23-
font: Font.boldSystemFont(ofSize: 50.0),
24-
color: Color(red: 0.171875, green: 0.2421875, blue: 0.3125, alpha: 1.0)))
25-
let headingStyle1 = document.add(style: PDFTextStyle(name: "Heading 1",
26-
font: Font.systemFont(ofSize: 15),
27-
color: Color.black))
28-
let headingStyle2 = document.add(style: PDFTextStyle(name: "Heading 2",
29-
font: Font.systemFont(ofSize: 10),
30-
color: Color.black))
21+
let titleStyle = document.add(style: PDFTextStyle(
22+
name: "Title",
23+
font: Font.boldSystemFont(ofSize: 50.0),
24+
color: Color(red: 0.171875, green: 0.2421875, blue: 0.3125, alpha: 1.0)
25+
))
26+
let headingStyle1 = document.add(style: PDFTextStyle(
27+
name: "Heading 1",
28+
font: Font.systemFont(ofSize: 15),
29+
color: Color.black
30+
))
31+
let headingStyle2 = document.add(style: PDFTextStyle(
32+
name: "Heading 2",
33+
font: Font.systemFont(ofSize: 10),
34+
color: Color.black
35+
))
3136

3237
// Add a string using the title style
3338
document.add(.contentCenter, textObject: PDFSimpleText(text: "TPPDF", style: titleStyle))
@@ -69,7 +74,7 @@ class TableOfContentsExampleFactory: ExampleFactory {
6974
document.add(space: 10)
7075

7176
document.add(text: LoremIpsum.get(words: 10))
72-
77+
7378
return [document]
7479
}
7580
}

Source/API/Delegation/PDFGeneratorImageDelegate.swift

+8-6
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77

88
import CoreGraphics
99

10+
/// Protocol used to delegate drawing of images
1011
public protocol PDFGeneratorImageDelegate: AnyObject {
12+
/**
13+
* Called directly before a ``PDFImage`` is drawn into the graphics context
14+
*
15+
* As the `image` is a reference object, it is possible to read and manipulate the object before rendering.
16+
*
17+
* One use-case could be overlaying the ``PDFImage/image`` with a watermark, after it final frame is calculated.
18+
*/
1119
func generator(willBeginDrawingImage image: PDFImage, with context: PDFContext, in frame: CGRect)
1220
}
13-
14-
public extension PDFGeneratorImageDelegate {
15-
16-
func generator(willBeginDrawingImage image: PDFImage, with context: PDFContext, in frame: CGRect) {}
17-
18-
}

0 commit comments

Comments
 (0)