PrintingKit is a Swift-based SDK that helps you print in Swift and SwiftUI.

What's New


This version adds PDF utilities and more print item types.

✨ New Features

  • Pdf is a new namespace with PDF-specific types.
  • PdfDataSource is a new protocol that is implemented by NSAttributedString.
  • Printer has new canPrint functions and properties.
  • PrinterView has new canPrint functions.
  • PrintItem has new .imageData, .pdfData, .attributedString, .string and .view types.

🚨 Breaking changes

  • PrinterItem.image(at:) has been renamed to .imageFile(at:).
  • PrinterItem.pdf(at:) has been renamed to .pdfFile(at:).

PrintingKit Logo

Version Swift 5.8 MIT License Twitter: @danielsaidi Mastodon:

About PrintingKit

PrintingKit helps you print PDF documents, images, etc. in Swift and SwiftUI.

For instance, to print a PDF file in the main bundle, just do this:

let bundle = Bundle.main
let url = bundle.url(forResource: "doc", withExtension: "pdf")
let item = PrintItem.pdfFile(at: url)
try? StandardPrinter().print(item)

PrintingKit currently supports the following PrintItem types:

  • .attributedString(_:configuration:) - an attributed string.
  • .imageData(_:) - JPG or PNG data.
  • .imageFile(at:) - a JPG or PNG file at a certain URL.
  • .pdfData(_:) - PDF document data.
  • .pdfFile(at:) - a PDF document file at a certain URL.
  • .string(_:configuration:) - a plain string.
  • .view(_:withScale:) - any SwiftUI view.

PrintingKit supports iOS 13 and macOS 11.


PrintingKit can be installed with the Swift Package Manager:

If you prefer to not have external dependencies, you can also just copy the source code into your app.

Getting started

The online documentation has a getting started guide that helps you get started with PrintingKit.

For instance, to print a PDF in SwiftUI, just do this:

struct MyView: View {

    var body: some View {
        Button("Print document") {
            let bundle = Bundle.main
            let url = bundle.url(forResource: "doc", withExtension: "pdf")
            let item = PrintItem.pdf(at: url)
            try? StandardPrinter().print(item)

You can also let your views implement PrinterView to make printing even easier.

For more information, see the getting started.


The online documentation has more information, code examples, etc., and lets you overview the various parts of the library.

Demo Application

The demo app lets you explore the library on iOS and macOS. To try it out, just open and run the Demo project.

Support this library

I manage my various open-source projects in my free time and am really thankful for any help I can get from the community.

You can sponsor this project on GitHub Sponsors or get in touch for paid support.


Feel free to reach out if you have questions or if you want to contribute in any way:


PrintingKit is available under the MIT license. See the LICENSE file for more info.


  • Swift Tools 5.8.0
View More Packages from this Author


  • None
Last updated: Mon Sep 18 2023 05:15:35 GMT-0900 (Hawaii-Aleutian Daylight Time)