Skip to content

A Swift library for generating PDF documents and reports with a SwiftUI like syntax.

License

Notifications You must be signed in to change notification settings

dkyowell/PDFBlocks

Repository files navigation

“PDFBlocks”

Swift Package Manager Mac + iOS

PDFBlocks is a powerful but easy to use PDF document and report generation library written in Swift for Apple platforms. Inspired by SwiftUI, it allows documents to be expressed with a declarative syntax. You just declare what you want printed within appropriate layout structures, and PDFBlocks takes care of positioning, pagination, and all the rest.

Sample Documents.

These sample documents and accompanying code provide examples of some of some of the layout capabilities of PDFBlocks.

Columns Stack Layout Report
“Columns “Stacks “Report
Code Code Code
Vector Drawing Gradient Fill Custom Components
“PDFBlocks”/ “PDFBlocks”/ “PDFBlocks”/
Code Code Code

Live Previews

PDFBlocks works very well with Xcode Previews. Instantly see your document rendered as a PDF as you code.

“Xcode

Xcode Previews ia also a great way to get a quick start with PDFBlocks before installing it into your own project.

  1. Download the PDFBlocks project.
  2. Open Package.swift in Xcode.
  3. Navigate to Examples directory
  4. Select scheme PDFBlocks-Package or PDFBlocksExamples
  5. Puruse the example documents. Modify them if you wish and see the results within Xcode.

Documentation

Documentation.md

Installation

PDFBlocks is distributed using the Swift Package Manager. To install it into a project, add it as a dependency within your Package.swift manifest:

let package = Package(
    ...
    dependencies: [
        .package(url: "https://github.com/dkyowell/pdfblocks.git", from: "0.2.4")
    ],
    ...
)

Then import PDFBlocks wherever you’d like to use it:

import PDFBlocks

Roadmap

Roadmap.md

Beta Release

This is a beta release. The API and layout heuristics could change up until the 1.0 release.

Support

Open an issue with questions or feature requests. I am actively developing this project and will try to accomodate requests that fit within the goals of the project. You can also send me an email at [email protected].