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.
Jump to: Features · Installation · Usage · Customization · Wiki
Get the book
EPUB edition
|
|
The Swift Programming Language, optimized for Apple Books. |
PDF editions
|
|
|
|
|
|
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
- Python 3.10+
- Git
- Specifically for generating PDF editions with
swift-book-pdf:- LuaTeX. If you don't have an existing LaTeX installation, see MacTeX, TeX Live, or MiKTeX.
- Fonts for typesetting. Learn which fonts are required to typeset the TSPL book.
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:
- Clone the
swift-bookrepository - Convert all Markdown source files into a single LaTeX document
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swift_book_pdf-2.4.1.tar.gz.
File metadata
- Download URL: swift_book_pdf-2.4.1.tar.gz
- Upload date:
- Size: 193.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45119ea4f4ae3360a4a7be90d85882b7553af14bc88727090d574c6f7e0a8599
|
|
| MD5 |
bbe868b15763d5324c66e4b8605fb801
|
|
| BLAKE2b-256 |
60a01110f37a7936382aea8221d28dacc452a0afbda8231f47330613e2c8931a
|
Provenance
The following attestation bundles were made for swift_book_pdf-2.4.1.tar.gz:
Publisher:
release.yml on ekassos/swift-book-pdf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swift_book_pdf-2.4.1.tar.gz -
Subject digest:
45119ea4f4ae3360a4a7be90d85882b7553af14bc88727090d574c6f7e0a8599 - Sigstore transparency entry: 1276868174
- Sigstore integration time:
-
Permalink:
ekassos/swift-book-pdf@49993678095a4bd2be55d04297f12c6e733ceb07 -
Branch / Tag:
refs/tags/v2.4.1 - Owner: https://github.com/ekassos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@49993678095a4bd2be55d04297f12c6e733ceb07 -
Trigger Event:
release
-
Statement type:
File details
Details for the file swift_book_pdf-2.4.1-py3-none-any.whl.
File metadata
- Download URL: swift_book_pdf-2.4.1-py3-none-any.whl
- Upload date:
- Size: 215.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
277a26583badd5c6d2d4348954248c1de575374a581a8735d7f966f41db01032
|
|
| MD5 |
cf449b7a2863aeb85f977efe178b812c
|
|
| BLAKE2b-256 |
a7556a0e9f3f0f4c69f8c16d6d0c1e018d4beeee3933968d62f8a918a6cabc37
|
Provenance
The following attestation bundles were made for swift_book_pdf-2.4.1-py3-none-any.whl:
Publisher:
release.yml on ekassos/swift-book-pdf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swift_book_pdf-2.4.1-py3-none-any.whl -
Subject digest:
277a26583badd5c6d2d4348954248c1de575374a581a8735d7f966f41db01032 - Sigstore transparency entry: 1276868178
- Sigstore integration time:
-
Permalink:
ekassos/swift-book-pdf@49993678095a4bd2be55d04297f12c6e733ceb07 -
Branch / Tag:
refs/tags/v2.4.1 - Owner: https://github.com/ekassos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@49993678095a4bd2be55d04297f12c6e733ceb07 -
Trigger Event:
release
-
Statement type: