Skip to content

Commit c82c75c

Browse files
Philip NiedertscheiderSgkhour
andauthored
Release/2.3.1 (#227)
* Added macOS compatibility to tests (#224) * Fixed missing file ref * #225: Fixing incorrect US page size (#226) Corrected the usLetter page height and usLedger page width to reflect 11inx72dpi * Fixed missing file ref * Updated changelog Co-authored-by: Sami Khoury <50881610+Sgkhour@users.noreply.github.com>
1 parent b46be9e commit c82c75c

File tree

70 files changed

+1021
-599
lines changed

Some content is hidden

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

70 files changed

+1021
-599
lines changed

.travis.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ stages:
2121
jobs:
2222
include:
2323
- stage: Tests
24-
name: "Unit Tests"
24+
name: "iOS Unit Tests"
2525
language: objective-c
2626
env:
2727
- TEST_FRAMEWORK_SCHEME="TPPDF-Package"
@@ -43,6 +43,25 @@ jobs:
4343
after_success:
4444
- bundle exec slather coverage -t --build-directory ${TRAVIS_BUILD_DIR}/derived_data
4545
- bash <(curl -s https://codecov.io/bash) -f cobertura.xml -X coveragepy -X gco
46+
- stage: Tests
47+
name: "macOS Unit Tests"
48+
language: objective-c
49+
env:
50+
- TEST_FRAMEWORK_SCHEME="TPPDF-Package"
51+
- PROJECT="TPPDF.xcodeproj"
52+
script:
53+
- set -o pipefail
54+
- swift package resolve
55+
- set -o pipefail
56+
- xcodebuild -project ${PROJECT}
57+
-scheme ${TEST_FRAMEWORK_SCHEME}
58+
-clonedSourcePackagesDirPath .
59+
-derivedDataPath ${TRAVIS_BUILD_DIR}/derived_data
60+
-sdk macosx
61+
-destination "platform=macOS"
62+
-configuration Debug
63+
ONLY_ACTIVE_ARCH=YES
64+
test | xcpretty
4665

4766
- stage: Examples
4867
name: "Example iOS - Cocoapods"

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@
77

88
**Fixed bugs:**
99

10+
- Fixed invalid US page formats (#225)
11+
1012
**Closed issues:**
1113

14+
- Issue #225
15+
1216
**Merged pull requests:**
1317

18+
- PR #226
19+
1420
## [2.3.0](https://github.com/techprimate/TPPDF/tree/2.3.0) (2020-07-16)
1521
[Full Changelog](https://github.com/techprimate/TPPDF/compare/2.2.0...2.3.0)
1622

Example macOS/Example.xcodeproj/project.pbxproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@
266266
isa = PBXProject;
267267
attributes = {
268268
LastSwiftUpdateCheck = 1150;
269-
LastUpgradeCheck = 1150;
269+
LastUpgradeCheck = 1160;
270270
ORGANIZATIONNAME = "techprimate GmbH & Co. KG";
271271
TargetAttributes = {
272272
D48C538424A269F400D7A3DD = {
@@ -478,6 +478,7 @@
478478
buildSettings = {
479479
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
480480
CODE_SIGN_ENTITLEMENTS = Example/Example.entitlements;
481+
CODE_SIGN_IDENTITY = "-";
481482
CODE_SIGN_STYLE = Manual;
482483
COMBINE_HIDPI_IMAGES = YES;
483484
DEVELOPMENT_ASSET_PATHS = "\"Example/Preview Content\"";
@@ -502,6 +503,7 @@
502503
buildSettings = {
503504
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
504505
CODE_SIGN_ENTITLEMENTS = Example/Example.entitlements;
506+
CODE_SIGN_IDENTITY = "-";
505507
CODE_SIGN_STYLE = Manual;
506508
COMBINE_HIDPI_IMAGES = YES;
507509
DEVELOPMENT_ASSET_PATHS = "\"Example/Preview Content\"";

Example macOS/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1150"
3+
LastUpgradeVersion = "1160"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Example macOS/Example/AppDelegate.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
2727
window.setFrameAutosaveName("Main Window")
2828
window.contentView = NSHostingView(rootView: contentView)
2929
window.makeKeyAndOrderFront(nil)
30+
window.setFrameAutosaveName("main")
3031
}
3132

3233
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {

Example macOS/Example/UI/ContentView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import TPPDF
1313
class ContentViewModel: ObservableObject {
1414

1515
@Published var url: URL?
16-
@State var selectedFactory = Examples.factories.first?.examples.first
16+
@State var selectedFactory = Examples.defaultFactory
1717

1818
}
1919

@@ -37,7 +37,7 @@ struct ContentView: View {
3737
alignment: .topLeading)
3838
.listStyle(SidebarListStyle())
3939

40-
DetailView(example: viewModel.selectedFactory!)
40+
DetailView(example: viewModel.selectedFactory)
4141
.frame(minWidth: 0, maxWidth: .infinity,
4242
minHeight: 0, maxHeight: .infinity,
4343
alignment: .topLeading)

Shared/Examples/Examples.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,9 @@ enum Examples {
4848
])
4949
]
5050
}
51+
52+
static var defaultFactory: Example {
53+
return factories[1].examples[0]
54+
}
5155
}
5256

Shared/Examples/TableExampleFactory.swift

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class TableExampleFactory: ExampleFactory {
2020
let document = PDFDocument(format: .a4)
2121

2222
// Create a table
23-
let table = PDFTable(rows: 10, columns: 4)
23+
var table = PDFTable(rows: 10, columns: 4)
2424

2525
// Tables can contain Strings, Numbers, Images or nil, in case you need an empty cell.
2626
// If you add a unknown content type, an assertion will be thrown and the rendering will stop.
@@ -85,6 +85,40 @@ class TableExampleFactory: ExampleFactory {
8585

8686
document.add(table: table)
8787

88+
// Another table:
89+
90+
table = PDFTable(rows: 50, columns: 4)
91+
table.widths = [0.1, 0.3, 0.3, 0.3]
92+
table.margin = 10
93+
table.padding = 10
94+
table.showHeadersOnEveryPage = false
95+
table.style.columnHeaderCount = 3
96+
97+
for row in 0..<table.size.rows {
98+
table[row, 0].content = "\(row)".asTableContent
99+
for column in 1..<table.size.columns {
100+
table[row, column].content = "\(row),\(column)".asTableContent
101+
}
102+
}
103+
104+
for i in stride(from: 3, to: 48, by: 3) {
105+
table[rows: i...(i + 2), column: 1].merge(with: PDFTableCell(content: Array(repeating: "\(i),1", count: 3).joined(separator: "\n").asTableContent,
106+
alignment: .center))
107+
}
108+
for i in stride(from: 4, to: 47, by: 3) {
109+
table[rows: i...(i + 2), column: 2].merge(with: PDFTableCell(content: Array(repeating: "\(i),2", count: 3).joined(separator: "\n").asTableContent,
110+
alignment: .center))
111+
}
112+
for i in stride(from: 5, to: 48, by: 3) {
113+
table[rows: i...(i + 2), column: 3].merge(with: PDFTableCell(content: Array(repeating: "\(i),3", count: 3).joined(separator: "\n").asTableContent,
114+
alignment: .center))
115+
}
116+
117+
table[rows: 0..<2, column: 2].merge()
118+
table[rows: 1..<3, column: 3].merge()
119+
120+
document.add(table: table)
121+
88122
return [document]
89123
}
90124
}

Source/API/Groups/PDFGroup+Objects.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public extension PDFGroup {
126126
- parameter container: Container whose text color will be reset, defaults to `PDFGroupContainer.left`
127127
*/
128128
func resetFont(_ container: PDFGroupContainer = PDFGroupContainer.left) {
129-
objects += [(container, PDFFontObject(font: Font.systemFont(ofSize: Font.systemFontSize)))]
129+
objects += [(container, PDFFontObject(font: Font.systemFont(ofSize: PDFConstants.defaultFontSize)))]
130130
}
131131

132132
/**

Source/API/PDFDocument.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public class PDFDocument: CustomStringConvertible {
180180
- parameter container: Container whose text color will be reset, defaults to `PDFContainer.contentLeft`
181181
*/
182182
public func resetFont(_ container: PDFContainer = PDFContainer.contentLeft) {
183-
objects += [(container, PDFFontObject(font: Font.systemFont(ofSize: Font.systemFontSize)))]
183+
objects += [(container, PDFFontObject(font: Font.systemFont(ofSize: PDFConstants.defaultFontSize)))]
184184
}
185185

186186
/**

0 commit comments

Comments
 (0)