Skip to content

Commit

Permalink
Release 2.3.3 (#260)
Browse files Browse the repository at this point in the history
* Added object tags
* Fixed equality patterns
* Added Hashable and Equatable
* Fixed project setup
* Updated SwiftPM dependencies
* Added PDFContext for encapsulated rendering
* Fixed build of unit tests
* Fixed deployment versions
* CI build destination bump
* Fixed external document inserting empty page when debugging
* Fixed total page count calculations with external documents
* Fixed module maps
* Fixed linting setup
* Fixed carthage compilation in Xcode 12
* Added more integration test cases for merging multiple external documents and total page count calculation
* Removed empty pages between batching external documents
* Updated changelog, added 2.3.3
* Fixed usage description
* Version bump to 2.3.3
  • Loading branch information
Philip Niedertscheider authored Jan 6, 2021
1 parent 8f55b0a commit f6cc251
Show file tree
Hide file tree
Showing 99 changed files with 4,436 additions and 2,546 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ Example*/Pods/Swiftlint
# Xcode Schemes, so Carthage doesn't complain
!Example iOS/TPPDF.xcodeproj/xcsharedata/xcschemes/TPPDF.xcscheme
!Example iOS/TPPDF.xcodeproj/xcsharedata/xcschemes/TPPDF-Example.xcscheme

# Ruby Gems
vendor
2 changes: 1 addition & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ identifier_name:
error: 2
warning: 2
included:
- ../Source
- Source
line_length: 150
reporter: xcode
type_body_length:
Expand Down
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
os: osx
osx_image: xcode11.6
osx_image: xcode12.2
language: objective-c
cache:
- bundler

env:
global:
- DESTINATION="OS=13.4,name=iPhone 11 Pro"
- DESTINATION="OS=14.2,name=iPhone 11 Pro"
- WORKSPACE="Example.xcworkspace"
- PROJECT="Example.xcodeproj"
- EXAMPLE_SCHEME="Example"
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
before_script:
- cd "${ROOT_FOLDER}"
- echo 'github "techprimate/TPPDF" "'$(git rev-parse HEAD)'"' > Cartfile
- carthage update --platform ios --cache-builds
- ../scripts/carthage.sh update --platform ios --cache-builds
script:
- set -o pipefail
- xcodebuild -project "$PROJECT"
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
-scheme ${EXAMPLE_SCHEME}
-clonedSourcePackagesDirPath .
-derivedDataPath ${TRAVIS_BUILD_DIR}/derived_data
-sdk macosx10.15
-sdk macosx
-configuration Debug
ONLY_ACTIVE_ARCH=YES
build | xcpretty
Expand Down
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Change Log

## [Unreleased](https://github.com/techprimate/TPPDF/tree/HEAD) (2020-??-??)
[Full Changelog](https://github.com/techprimate/TPPDF/compare/2.3.2...HEAD)
[Full Changelog](https://github.com/techprimate/TPPDF/compare/2.3.3...HEAD)

**Implemented enhancements:**

Expand All @@ -11,6 +11,23 @@

**Merged pull requests:**

## [2.3.3](https://github.com/techprimate/TPPDF/tree/HEAD) (2020-??-??)
[Full Changelog](https://github.com/techprimate/TPPDF/compare/2.3.2...2.3.3)

**Fixed bugs:**

- Fixed empty pages between external documents (#247)
- Fixed total page count calculations (#248)

**Closed issues:**

- Issue #247
- Issue #248

**Merged pull requests:**

- Issue #258

## [2.3.2](https://github.com/techprimate/TPPDF/tree/2.3.2) (2020-12-05)
[Full Changelog](https://github.com/techprimate/TPPDF/compare/2.3.1...2.3.2)

Expand Down
44 changes: 35 additions & 9 deletions Documentation/Usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
- [Document Info](#document-info)
- [Generation](#generation)
- [Multiple Documents](#multiple-documents)
* [Progress Observing](#progress-observing)
* [Debug](#debug)

## Getting Started
Expand Down Expand Up @@ -738,7 +739,7 @@ You can generate the PDF file using the following method:
let document: PDFDocument
let filename = "awesome.pdf"
let generator = PDFGenerator(document: document)
let url = try generator.generateURL(document: document, filename: filename)
let url = try generator.generateURL(filename: filename)
```

This will render the document to a temporary file and return the URL. Be sure to wrap it a `try-catch` block, as it might throw an error!
Expand All @@ -749,7 +750,7 @@ It is also possible to render the file and return the data, using `generateData`
let document: PDFDocument
let filename = "awesome.pdf"
let generator = PDFGenerator(document: document)
let data = try generator.generateData(document: document, filename: filename)
let data = try generator.generateData()
```

And if you want to directly save it to a specific file, pass an URL to `generate(document:, to: )`:
Expand All @@ -769,19 +770,34 @@ If you want to combine multiple `PDFDocument` into a single PDF file, use the al

```swift
let generator = PDFMultiDocumentGenerator(documents: [document1, document2])
generator.progress.observe(\.fractionCompleted) { (p, _) in
let url = try generator.generateURL(filename: "Example.pdf")
```

Also you are able to track the generation of each individual document using the `progresses` array:

**Example:**

```swift
let generator = PDFMultiDocumentGenerator(documents: [document1, document2])
generator.progresses[0].observe(\.fractionCompleted) { (p, _) in
print(p.localizedDescription ?? "")
}
```

# Progress Observing

Progress observing is done using the native `Progress` handling.

**Example:**

```swift
let generator = PDFDocumentGenerator(document: document)
generator.progress.observe(\.fractionCompleted) { (p, _) in
print(p.localizedDescription ?? "")
}
generator.progress.observe(\.completedUnitCount) { (p, _) in
print(p.completedUnitCount ?? "", " of ", p.totalUnitCount)
}
let url = try generator.generateURL(filename: "Example.pdf")
```

Also you are able to track the generation of each individual document using the `progresses` array:
Also you are able to track the generation of each individual document when rendering multiple documents by using the `progresses` array:

**Example:**

Expand All @@ -792,6 +808,16 @@ generator.progresses[0].observe(\.fractionCompleted) { (p, _) in
}
```

You can find more about `Progress` handling in the Apple Developer documentation.

# Debug

If you want to enable a debug overlay, set the flag `debug` in `PDFGenerator::generate(..)`, `PDFGenerator::generateURL(..)` or `PDFGenerator::generateData(..)` to `true` and it will add colored outlines of the elements in you document.
If you want to enable a debug overlay, set the flag `debug` of the `PDFGenerator` instance to `true` and it will add colored outlines of the elements in you document.

**Example:**

```swift
let document: PDFDocument
let generator = PDFDocumentGenerator(document: document)
generator.debug = true
```
6 changes: 5 additions & 1 deletion Example iOS-SwiftPM/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
D49855532461FB0B00D54270 /* Image-4.jpg in Resources */ = {isa = PBXBuildFile; fileRef = D49855372461FB0B00D54270 /* Image-4.jpg */; };
D49855542461FB0B00D54270 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = D49855382461FB0B00D54270 /* Icon.png */; };
D49855562461FB9A00D54270 /* Examples.swift in Sources */ = {isa = PBXBuildFile; fileRef = D49855552461FB9A00D54270 /* Examples.swift */; };
D4B7EB0725A1D345007D09C7 /* sample-large.pdf in Resources */ = {isa = PBXBuildFile; fileRef = D4B7EB0525A1D32F007D09C7 /* sample-large.pdf */; };
D4D28D2323AA1A6D00028D5A /* ExamplesListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4D28D2223AA1A6D00028D5A /* ExamplesListViewController.swift */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -81,6 +82,7 @@
D49855372461FB0B00D54270 /* Image-4.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "Image-4.jpg"; sourceTree = "<group>"; };
D49855382461FB0B00D54270 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };
D49855552461FB9A00D54270 /* Examples.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Examples.swift; sourceTree = "<group>"; };
D4B7EB0525A1D32F007D09C7 /* sample-large.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "sample-large.pdf"; sourceTree = "<group>"; };
D4D28D2223AA1A6D00028D5A /* ExamplesListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExamplesListViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -197,6 +199,7 @@
D498552F2461FB0B00D54270 /* Documents */ = {
isa = PBXGroup;
children = (
D4B7EB0525A1D32F007D09C7 /* sample-large.pdf */,
D49855302461FB0B00D54270 /* sample.pdf */,
);
path = Documents;
Expand Down Expand Up @@ -310,6 +313,7 @@
607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */,
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */,
607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */,
D4B7EB0725A1D345007D09C7 /* sample-large.pdf in Resources */,
D49855512461FB0B00D54270 /* Image-3.jpg in Resources */,
D498554F2461FB0B00D54270 /* PortraitImage.jpg in Resources */,
D49855542461FB0B00D54270 /* Icon.png in Resources */,
Expand All @@ -333,7 +337,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftlint >/dev/null; then\n \"swiftlint\" --config ../.swiftlint.yml\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
shellScript = "if which swiftlint >/dev/null; then\n if [-z \"$CI\"]; then\n echo \"Skipping SwiftLint as running on CI...\"\n else\n cd ../\n \"swiftlint\" --config .swiftlint.yml\n fi\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,40 @@
{
"object": {
"pins": [
{
"package": "CwlCatchException",
"repositoryURL": "https://github.com/mattgallagher/CwlCatchException.git",
"state": {
"branch": null,
"revision": "f809deb30dc5c9d9b78c872e553261a61177721a",
"version": "2.0.0"
}
},
{
"package": "CwlPreconditionTesting",
"repositoryURL": "https://github.com/mattgallagher/CwlPreconditionTesting.git",
"state": {
"branch": null,
"revision": "02b7a39a99c4da27abe03cab2053a9034379639f",
"version": "2.0.0"
}
},
{
"package": "Nimble",
"repositoryURL": "https://github.com/Quick/Nimble",
"state": {
"branch": null,
"revision": "2b1809051b4a65c1d7f5233331daa24572cd7fca",
"version": "8.1.1"
"revision": "e491a6731307bb23783bf664d003be9b2fa59ab5",
"version": "9.0.0"
}
},
{
"package": "Quick",
"repositoryURL": "https://github.com/Quick/Quick",
"state": {
"branch": null,
"revision": "09b3becb37cb2163919a3842a4c5fa6ec7130792",
"version": "2.2.1"
"revision": "0038bcbab4292f3b028632556507c124e5ba69f3",
"version": "3.0.0"
}
}
]
Expand Down
8 changes: 7 additions & 1 deletion Example macOS/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
D48C53D924A26C0000D7A3DD /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = D48C53BD24A26C0000D7A3DD /* Icon.png */; };
D48C53DC24A26E5400D7A3DD /* TPPDF in Frameworks */ = {isa = PBXBuildFile; productRef = D48C53DB24A26E5400D7A3DD /* TPPDF */; };
D48C53DE24A27A0100D7A3DD /* PDFView+SwiftUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = D48C53DD24A27A0100D7A3DD /* PDFView+SwiftUI.swift */; };
D4B7EB0B25A1DAD2007D09C7 /* sample-large.pdf in Resources */ = {isa = PBXBuildFile; fileRef = D4B7EB0A25A1DACE007D09C7 /* sample-large.pdf */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -87,6 +88,7 @@
D48C53BC24A26C0000D7A3DD /* Image-4.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "Image-4.jpg"; sourceTree = "<group>"; };
D48C53BD24A26C0000D7A3DD /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };
D48C53DD24A27A0100D7A3DD /* PDFView+SwiftUI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PDFView+SwiftUI.swift"; sourceTree = "<group>"; };
D4B7EB0A25A1DACE007D09C7 /* sample-large.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "sample-large.pdf"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -210,6 +212,7 @@
D48C53B424A26C0000D7A3DD /* Documents */ = {
isa = PBXGroup;
children = (
D4B7EB0A25A1DACE007D09C7 /* sample-large.pdf */,
D48C53B524A26C0000D7A3DD /* sample.pdf */,
);
path = Documents;
Expand Down Expand Up @@ -266,7 +269,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1150;
LastUpgradeCheck = 1160;
LastUpgradeCheck = 1230;
ORGANIZATIONNAME = "techprimate GmbH & Co. KG";
TargetAttributes = {
D48C538424A269F400D7A3DD = {
Expand Down Expand Up @@ -303,6 +306,7 @@
D48C539324A269F500D7A3DD /* Main.storyboard in Resources */,
D48C539024A269F500D7A3DD /* Preview Assets.xcassets in Resources */,
D48C538D24A269F500D7A3DD /* Assets.xcassets in Resources */,
D4B7EB0B25A1DAD2007D09C7 /* sample-large.pdf in Resources */,
D48C53D624A26C0000D7A3DD /* Image-3.jpg in Resources */,
D48C53D424A26C0000D7A3DD /* PortraitImage.jpg in Resources */,
D48C53D924A26C0000D7A3DD /* Icon.png in Resources */,
Expand Down Expand Up @@ -386,6 +390,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -446,6 +451,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,40 @@
{
"object": {
"pins": [
{
"package": "CwlCatchException",
"repositoryURL": "https://github.com/mattgallagher/CwlCatchException.git",
"state": {
"branch": null,
"revision": "f809deb30dc5c9d9b78c872e553261a61177721a",
"version": "2.0.0"
}
},
{
"package": "CwlPreconditionTesting",
"repositoryURL": "https://github.com/mattgallagher/CwlPreconditionTesting.git",
"state": {
"branch": null,
"revision": "02b7a39a99c4da27abe03cab2053a9034379639f",
"version": "2.0.0"
}
},
{
"package": "Nimble",
"repositoryURL": "https://github.com/Quick/Nimble",
"state": {
"branch": null,
"revision": "72f5a90d573f7f7d70aa6b8ad84b3e1e02eabb4d",
"version": "8.0.9"
"revision": "e491a6731307bb23783bf664d003be9b2fa59ab5",
"version": "9.0.0"
}
},
{
"package": "Quick",
"repositoryURL": "https://github.com/Quick/Quick",
"state": {
"branch": null,
"revision": "33682c2f6230c60614861dfc61df267e11a1602f",
"version": "2.2.0"
"revision": "0038bcbab4292f3b028632556507c124e5ba69f3",
"version": "3.0.0"
}
}
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1160"
LastUpgradeVersion = "1230"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -28,6 +28,26 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "TPPDFIntegrationTests"
BuildableName = "TPPDFIntegrationTests"
BlueprintName = "TPPDFIntegrationTests"
ReferencedContainer = "container:..">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "TPPDFTests"
BuildableName = "TPPDFTests"
BlueprintName = "TPPDFTests"
ReferencedContainer = "container:..">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
Loading

0 comments on commit f6cc251

Please sign in to comment.