tldr/scripts/pdf
K.B.Dharun Krishna 4e53530691
feat/scripts: support generating PDFs for platforms (#11195)
* feat/scripts: support generating PDFs for platform

Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>

* render.py: reformat code for black

Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>

* PDF/README: update command

Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>

* render.py: update code

Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>

* render.py: drop platform none parameter from main

Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>

---------

Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
2023-10-24 00:59:43 +05:30
..
NotoSans-Regular.ttf scripts: build and deploy PDF pages for translations (#10969) 2023-10-22 02:34:22 +05:30
README.md feat/scripts: support generating PDFs for platforms (#11195) 2023-10-24 00:59:43 +05:30
basic.css scripts: build and deploy PDF pages for translations (#10969) 2023-10-22 02:34:22 +05:30
build-pdf.sh scripts: build and deploy PDF pages for translations (#10969) 2023-10-22 02:34:22 +05:30
render.py feat/scripts: support generating PDFs for platforms (#11195) 2023-10-24 00:59:43 +05:30
requirements.txt Rework PDF script (#3654) 2019-12-17 21:25:52 +01:00
solarized-dark.css scripts: add SPDX-License-Identifier in files (#6215) 2021-07-16 14:15:31 +01:00
solarized-light.css scripts: add SPDX-License-Identifier in files (#6215) 2021-07-16 14:15:31 +01:00

README.md

pdf

This directory contains the script and related resources to generate a PDF document with all the tldr pages.

Highlights

  • No LaTeX dependencies for generating the PDF.
  • 3 available color-schemes: Basic, Solarized Light and Solarized Dark. More can be added easily through CSS.

Requirements

The PDF is generated by first converting the Markdown files to HTML, and then rendering those HTML files as a PDF. It depends on the markdown and weasyprint libraries. To install the dependencies, run:

python3 -m pip install -r requirements.txt

Make sure OS specific dependencies for WeasyPrint are installed by following the instructions here.

Usage

Generating the PDF is as simple as running:

python3 render.py <path-to-pages-directory> [--color <color-scheme>] [--output <filename>] [--platform <platform-name>]

Complete information about the arguments can be viewed by running:

python3 render.py --help

Available color schemes:

  • basic
  • solarized-light
  • solarized-dark

Preview

cryptsetup in the Basic color-scheme. cryptsetup in the Solarized Light color-scheme. cryptsetup in the Solarized Dark color-scheme.