Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
philprime committed Apr 24, 2024
1 parent d0510a2 commit 73e902e
Show file tree
Hide file tree
Showing 202 changed files with 63 additions and 118,593 deletions.
18 changes: 18 additions & 0 deletions Examples.xcworkspace/xcshareddata/swiftpm/Package.resolved
Expand Up @@ -36,6 +36,24 @@
"revision": "8cce6acd38f965f5baa3167b939f86500314022b",
"version": "3.1.2"
}
},
{
"package": "SwiftDocCPlugin",
"repositoryURL": "https://github.com/apple/swift-docc-plugin",
"state": {
"branch": null,
"revision": "26ac5758409154cc448d7ab82389c520fa8a8247",
"version": "1.3.0"
}
},
{
"package": "SymbolKit",
"repositoryURL": "https://github.com/apple/swift-docc-symbolkit",
"state": {
"branch": null,
"revision": "b45d1f2ed151d057b54504d653e0da5552844e34",
"version": "1.0.0"
}
}
]
},
Expand Down
26 changes: 22 additions & 4 deletions Package.resolved
Expand Up @@ -6,17 +6,17 @@
"repositoryURL": "https://github.com/mattgallagher/CwlCatchException.git",
"state": {
"branch": null,
"revision": "35f9e770f54ce62dd8526470f14c6e137cef3eea",
"version": "2.1.1"
"revision": "3ef6999c73b6938cc0da422f2c912d0158abb0a0",
"version": "2.2.0"
}
},
{
"package": "CwlPreconditionTesting",
"repositoryURL": "https://github.com/mattgallagher/CwlPreconditionTesting.git",
"state": {
"branch": null,
"revision": "c21f7bab5ca8eee0a9998bbd17ca1d0eb45d4688",
"version": "2.1.0"
"revision": "2ef56b2caf25f55fa7eef8784c30d5a767550f54",
"version": "2.2.1"
}
},
{
Expand All @@ -36,6 +36,24 @@
"revision": "8cce6acd38f965f5baa3167b939f86500314022b",
"version": "3.1.2"
}
},
{
"package": "SwiftDocCPlugin",
"repositoryURL": "https://github.com/apple/swift-docc-plugin",
"state": {
"branch": null,
"revision": "26ac5758409154cc448d7ab82389c520fa8a8247",
"version": "1.3.0"
}
},
{
"package": "SymbolKit",
"repositoryURL": "https://github.com/apple/swift-docc-symbolkit",
"state": {
"branch": null,
"revision": "b45d1f2ed151d057b54504d653e0da5552844e34",
"version": "1.0.0"
}
}
]
},
Expand Down
1 change: 1 addition & 0 deletions Package.swift
Expand Up @@ -14,6 +14,7 @@ let package = Package(
dependencies: [
.package(url: "https://github.com/Quick/Quick", .exact("3.1.2")),
.package(url: "https://github.com/Quick/Nimble", .exact("9.2.1")),
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.1.0"),
],
targets: [
.target(name: "TPPDF", path: "Source"),
Expand Down
2 changes: 1 addition & 1 deletion Source/API/Layout/PDFContainer.swift
Expand Up @@ -96,7 +96,7 @@ public enum PDFContainer: CaseIterable {
[
.headerLeft, .headerCenter, .headerRight,
.contentLeft, .contentCenter, .contentRight,
.footerLeft, .footerCenter, .footerRight,
.footerLeft, .footerCenter, .footerRight
]
}
}
2 changes: 1 addition & 1 deletion Source/API/Metadata/PDFInfo.swift
Expand Up @@ -98,7 +98,7 @@ public class PDFInfo {
kCGPDFContextSubject as String: subject,
kCGPDFContextKeywords as String: keywords,
kCGPDFContextAllowsPrinting as String: allowsPrinting,
kCGPDFContextAllowsCopying as String: allowsCopying,
kCGPDFContextAllowsCopying as String: allowsCopying
]

var creator = Bundle.main.infoDictionary?["CFBundleName"] as? String ?? "TPPDF"
Expand Down
2 changes: 1 addition & 1 deletion Source/API/PDFGenerator+Generation.swift
Expand Up @@ -329,7 +329,7 @@ public extension PDFGenerator {
layout.margin.top + layout.heights.maxHeaderHeight(),
layout.margin.top + layout.heights.maxHeaderHeight() + document.layout.space.header,
document.layout.height - layout.margin.bottom - layout.heights.maxFooterHeight(),
document.layout.height - layout.margin.bottom - layout.heights.maxFooterHeight() - document.layout.space.footer,
document.layout.height - layout.margin.bottom - layout.heights.maxFooterHeight() - document.layout.space.footer
]

var lines: [PDFLineObject] = []
Expand Down
8 changes: 2 additions & 6 deletions Source/API/Utils/PDFError.swift
Expand Up @@ -9,11 +9,7 @@ import Foundation

/// List of errors which can be thrown during configuration, calculations or rendering
public enum PDFError: LocalizedError {
/**
* The associated `value` is an instance of an unsupported type.
*
* See ``PDFTableContent/setContent(content:)`` for details.
*/
/// The associated `value` is an instance of an unsupported type.
case tableContentInvalid(value: Any?)

/// Indicates that a table without any data was added to the document, which is unsupported
Expand All @@ -28,7 +24,7 @@ public enum PDFError: LocalizedError {
/// Indicates that the cell is too big to be rendered onto a single page
case tableCellTooBig(cell: PDFTableCell)

/// Thrown when neither a ``PDFSimpleText`` nor a ``NSAttributedString`` is set in an ``PDFAttributedText``
/// Thrown when neither a ``PDFSimpleText`` nor a ``UIKit/NSAttributedString`` is set in an ``PDFAttributedText``
case textObjectIsNil

/// Thrown when a ``PDFAttributedText`` should be rendered without being calculated first
Expand Down
2 changes: 1 addition & 1 deletion Source/Internal/External/PDFExternalPageObject.swift
Expand Up @@ -21,7 +21,7 @@ class PDFExternalPageObject: PDFRenderObject {
override func calculate(generator _: PDFGenerator, container: PDFContainer) throws -> [PDFLocatedRenderObject] {
frame = page.getBoxRect(.mediaBox)
return [
(container, self),
(container, self)
]
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Internal/Graphics/PDFContextGraphics.swift
Expand Up @@ -63,7 +63,7 @@ enum PDFContextGraphics {
var mediaBox = bounds
let boxData = NSData(bytes: &mediaBox, length: MemoryLayout.size(ofValue: mediaBox))
let pageInfo = [
kCGPDFContextMediaBox as String: boxData,
kCGPDFContextMediaBox as String: boxData
]
context.beginPDFPage(pageInfo as CFDictionary)

Expand Down
2 changes: 1 addition & 1 deletion Source/Internal/Group/PDFGroupObject.swift
Expand Up @@ -95,7 +95,7 @@ class PDFGroupObject: PDFRenderObject {
}

var groupedResult = [
[PDFLocatedRenderObject](),
[PDFLocatedRenderObject]()
]

// Set padding
Expand Down
20 changes: 10 additions & 10 deletions Source/Internal/Layout/PDFColumnLayoutState.swift
Expand Up @@ -53,27 +53,27 @@ class PDFColumnLayoutState: CustomStringConvertible {
self.currentColumn = [
.headerLeft: 0,
.contentLeft: 0,
.footerLeft: 0,
.footerLeft: 0
]
self.columnWidths = [
.headerLeft: [],
.contentLeft: [],
.footerLeft: [],
.footerLeft: []
]
self.columnSpacings = [
.headerLeft: [],
.contentLeft: [],
.footerLeft: [],
.footerLeft: []
]
self.wrapColumnsHeight = [
.headerLeft: 0,
.contentLeft: 0,
.footerLeft: 0,
.footerLeft: 0
]
self.inset = [
.headerLeft: (0, 0),
.contentLeft: (0, 0),
.footerLeft: (0, 0),
.footerLeft: (0, 0)
]
}

Expand All @@ -85,27 +85,27 @@ class PDFColumnLayoutState: CustomStringConvertible {
currentColumn = [
.headerLeft: 0,
.contentLeft: 0,
.footerLeft: 0,
.footerLeft: 0
]
columnWidths = [
.headerLeft: [],
.contentLeft: [],
.footerLeft: [],
.footerLeft: []
]
columnSpacings = [
.headerLeft: [],
.contentLeft: [],
.footerLeft: [],
.footerLeft: []
]
wrapColumnsHeight = [
.headerLeft: 0,
.contentLeft: 0,
.footerLeft: 0,
.footerLeft: 0
]
inset = [
.headerLeft: (0, 0),
.contentLeft: (0, 0),
.footerLeft: (0, 0),
.footerLeft: (0, 0)
]
}

Expand Down
4 changes: 2 additions & 2 deletions Source/Internal/Table/PDFTableObject.swift
Expand Up @@ -270,7 +270,7 @@ class PDFTableObject: PDFRenderObject {
let attributes: [NSAttributedString.Key: AnyObject] = [
.foregroundColor: cellStyle.colors.text,
.font: cellStyle.font,
.paragraphStyle: paragraph,
.paragraphStyle: paragraph
]
return NSAttributedString(string: text, attributes: attributes)
}
Expand Down Expand Up @@ -606,7 +606,7 @@ class PDFTableObject: PDFRenderObject {
endPoint: CGPoint(x: frame.maxX, y: frame.maxY)),
PDFLineObject(style: borders.left,
startPoint: CGPoint(x: frame.minX, y: frame.minY),
endPoint: CGPoint(x: frame.minX, y: frame.maxY)),
endPoint: CGPoint(x: frame.minX, y: frame.maxY))
]
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Internal/Text/PDFAttributedTextObject.swift
Expand Up @@ -287,7 +287,7 @@ class PDFAttributedTextObject: PDFRenderObject {
return [
NSAttributedString.Key.font: style?.font ?? fonts[container]!,
NSAttributedString.Key.foregroundColor: style?.color ?? textColor[container]!,
NSAttributedString.Key.paragraphStyle: paragraphStyle,
NSAttributedString.Key.paragraphStyle: paragraphStyle
]
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Internal/Utils/PDFSlicedObject.swift
Expand Up @@ -23,7 +23,7 @@ class PDFSlicedObject: PDFRenderObject {

override func calculate(generator _: PDFGenerator, container: PDFContainer) throws -> [PDFLocatedRenderObject] {
[
(container, self),
(container, self)
]
}

Expand Down

0 comments on commit 73e902e

Please sign in to comment.