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.0.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.0-py3-none-any.whl (391.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: swift_book_pdf-2.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 a59eb46ceb70903441c5fb17b1830d8e923a97b0da53913b10f87153d9e900c5
MD5 8bf296eda8ce7a11ff2bc179aafcfef8
BLAKE2b-256 d5ce1eaadd98905df3e91a55a08f55fe660657f223bb7adc3ff3dac591b237d4

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: swift_book_pdf-2.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f16d1745bd4fde8b94726e473b04f587cd2fd8c592e993e26a97d751587b9464
MD5 3022bf2d4a8110547c71b021695c6fc7
BLAKE2b-256 f39545053013ee342f644a497207c85021585399afde41768c4a4c333d4dc136

See more details on using hashes here.

Provenance

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