Skip to main content

Generate polished PDF and EPUB editions of The Swift Programming Language book.

Project description

PDF & EPUB Renderer for The Swift Programming Language

Convert the DocC source for The Swift Programming Language book into polished PDF and EPUB editions.

The image shows The Swift Programming Language book displayed across three devices: a 14-inch MacBook Pro (M4) in Silver, an 11-inch iPad Pro (M4) in Space Gray, and an iPhone 17 Pro in Deep Blue. Each screen shows pages from the book titled Collection Types, featuring diagrams, code snippets, and explanations about arrays, sets, and dictionaries in Swift. Below the devices, centered text reads 'Swift Book PDF' followed by a large bold headline, 'Learn Swift anywhere.' The background is clean and light gray, emphasizing the devices and text.

Jump to: Features · Installation · Usage · Customization · Wiki

Get the book

EPUB edition

Read the latest edition. Click this image to get it on Apple Books.

The Swift Programming Language, optimized for Apple Books.

Open in Apple Books ↗

Get it on Apple Books

PDF editions

Download Digital edition PDF

Download Print edition PDF

Download Digital Dark edition PDF

Download Print Dark edition PDF

For versioned archives of the PDF editions, see swift-book-archive.

Features

PDF Generation (swift-book-pdf)

  • Generate a PDF edition of The Swift Programming Language, optimized for offline reading or printing.
  • Choose from one of two rendering modes:
    • Digital mode with hyperlinks for cross-references between chapters and external links.
    • Print mode with page numbers accompanying cross-references between chapters and full URLs shown in footnotes for external links.
  • Both versions follow the DocC rendering style used in docs.swift.org, including code highlighting.

EPUB Generation (swift-book-epub)

  • Generate an EPUB edition of The Swift Programming Language, ideal for e-readers and mobile devices.
  • The generated EPUB file follows the rendering style used by TSPL editions up to Swift 5.7 published on Apple Books and retains all internal references and external links.

Requirements

Installation

Latest PyPI stable release

pip install swift-book-pdf

Usage

PDF generation

Call swift-book-pdf without any arguments to save the resulting PDF as swift_book.pdf in the current directory. The package defaults to the digital rendering mode in Letter paper size.

$ swift-book-pdf

[INFO]: Downloading TSPL files...
[INFO]: Creating PDF in digital (light) mode...
[INFO]: PDF saved to ./swift-book.pdf

When invoked, swift-book-pdf will:

  1. Clone the swift-book repository
  2. Convert all Markdown source files into a single LaTeX document
  3. Render the LaTeX document into the final PDF document

EPUB generation

Call swift-book-epub without any arguments to save the resulting EPUB as swift_book.epub in the current directory.

$ swift-book-epub
[INFO]: Downloading TSPL files...
[INFO]: Creating EPUB...
[INFO]: EPUB saved to ./swift_book.epub

Customization

swift-book-pdf and swift-book-epub offer a range of options to customize your rendering of The Swift Programming Language book. Learn how to make the TSPL book your own.

License and Acknowledgments

Copyright © 2025–2026 Evangelos Kassos. swift-book-pdf is distributed under the Apache License, Version 2.0.

When you don't provide an input path, swift-book-pdf temporarily clones the swift-book repository for processing at runtime, but no part of the repository is directly redistributed here.

Editions generated by swift-book-pdf are derived from the swift-book source and are modified versions of the original work, converted and formatted for distribution. See the Acknowledgments chapter in each edition for more details. Passing --dangerously-skip-legal-notices suppresses the Acknowledgments chapter. Use of this option does not waive, limit, or satisfy any otherwise applicable legal obligations. Any person distributing an edition generated with this option remains solely responsible for compliance with all applicable attribution, licensing, trademark, notice, and non-affiliation requirements.

chapter-icon.png and chapter-icon~dark.png are derived from the ArticleIcon.vue component in the swift-docc-render repository. The swift-docc-render repository is part of the Swift.org open source project, which is licensed under the Apache License, Version 2.0 with Runtime Library Exception. See https://swift.org/LICENSE.txt for more details. Copyright © 2021–2025 Apple Inc. and the Swift project authors. The Swift project authors are credited at https://swift.org/CONTRIBUTORS.txt. See THIRD-PARTY-NOTICES.txt for more details.

The Swift logo is a trademark of Apple Inc. Neither this project nor output generated by swift-book-pdf is published by, endorsed by, or affiliated with Apple Inc. or the Swift.org open source project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swift_book_pdf-2.4.0.tar.gz (192.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swift_book_pdf-2.4.0-py3-none-any.whl (215.0 kB view details)

Uploaded Python 3

File details

Details for the file swift_book_pdf-2.4.0.tar.gz.

File metadata

  • Download URL: swift_book_pdf-2.4.0.tar.gz
  • Upload date:
  • Size: 192.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for swift_book_pdf-2.4.0.tar.gz
Algorithm Hash digest
SHA256 e268a98922abbe9978ce1966051c5c8e19819f2605388bb8d59a6bcd521bcda4
MD5 6b92f8e9700d7c155b1234b417a04ad8
BLAKE2b-256 3e8676bc7cc96dd7f45be1b8542e0f01aa0d85fff5ba4999f1ff7256e0defcc9

See more details on using hashes here.

Provenance

The following attestation bundles were made for swift_book_pdf-2.4.0.tar.gz:

Publisher: release.yml on ekassos/swift-book-pdf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file swift_book_pdf-2.4.0-py3-none-any.whl.

File metadata

  • Download URL: swift_book_pdf-2.4.0-py3-none-any.whl
  • Upload date:
  • Size: 215.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for swift_book_pdf-2.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9f6dc254773c6f8505148ce8651a45c875032ff3ef8adbc4efff453876ea4ba
MD5 e6a143b7f5b63f13c57c071c11de97e9
BLAKE2b-256 e80c12f7d57719c1a8dff8beebfc224fe1d9adbb9faba8c344140d225d869666

See more details on using hashes here.

Provenance

The following attestation bundles were made for swift_book_pdf-2.4.0-py3-none-any.whl:

Publisher: release.yml on ekassos/swift-book-pdf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page