Skip to main content

A tool to generate a PDF version of The Swift Programming Language book.

Project description

PDF Generator for The Swift Programming Language

Convert the DocC source for The Swift Programming Language book into a print-ready PDF document. The final document follows the DocC rendering style and retains all internal references and external links.

Preview Books (see swift-book-archive for versioned archives)
Digital Mode
Clickable links, best for on-screen reading
Print Mode
Page numbers & full URLs, best for printing
Light Mode Download book in digital mode Download book in print mode
Dark Mode Download book in digital mode Download book in print mode

The image showcases three pages of a PDF version of "The Swift Programming Language" book. The first page displays a table of contents, listing chapters like "Welcome to Swift" and "Language Guide" with page numbers. The second page contains Swift code examples and explanations about loops, including how to use a for-in loop. The third page continues discussing while loops with a visual example of a snakes and ladders game board. The pages maintain DocC styling with black headers and highlighted code sections.

Features

  • Generate a PDF version of the The Swift Programming Language book, perfect for offline browsing 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.

Requirements

Installation

Latest PyPI stable release

pip install swift-book-pdf

Usage

Basic usage

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

[!NOTE] swift_book_pdf will create a temporary directory to store the swift-book repository, LaTeX file and intermediate files produced during typesetting. This temporary directory is removed after the PDF is generated.

Customization

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

Acknowledgments

At runtime, the swift-book repository is temporarily cloned for processing, but no part of the repository is directly redistributed here.

chapter-icon.png and chapter-icon~dark.png are derived from the ArticleIcon.vue component in the swift-docc-render repository.

The swift-book and swift-docc-render repositories are part of the Swift.org open source project, which is licensed under the Apache License v2.0 with Runtime Library Exception. See https://swift.org/LICENSE.txt for more details. The Swift project authors are credited at https://swift.org/CONTRIBUTORS.txt.

The Swift logo is a trademark of Apple Inc.

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.0.1.tar.gz (376.9 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.0.1-py3-none-any.whl (391.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for swift_book_pdf-2.0.1.tar.gz
Algorithm Hash digest
SHA256 328c2aa51abb039a1e6a21c5f2a1d5ceb749d9e6c41e824ba8088d9e2779e390
MD5 3e0d7ac9e3006c4ebe49e07c6f571ba5
BLAKE2b-256 5a1c351a2d925674ab5730b3b2b923cd100408702474944ed7fcf431a96ea378

See more details on using hashes here.

Provenance

The following attestation bundles were made for swift_book_pdf-2.0.1.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.0.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for swift_book_pdf-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 82b639137bdb165ffd68da932a8d3f10ffc98cc7f71940ab421fbea6f795b7e1
MD5 28d25cdbcf7e2dfb2a50d6065d98b0b9
BLAKE2b-256 ceb506dab48ab0cc8b3f0c93b1128db31e632bddef8834b8d804eab1a9f9c81f

See more details on using hashes here.

Provenance

The following attestation bundles were made for swift_book_pdf-2.0.1-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