rst2pdf Examples
Here are a few examples of the kinds of things that rst2pdf can do, along with the source and style files so that you can use them as starting points for your own projects. You are very welcome to suggest additional examples by opening an issue on our source repo and to add your own examples - follow the CONTRIBUTING.md
file for more information.
Basic Document
A simple document with some headings and the basic rst2pdf styling.
- PDF: document1.pdf
- Content: document1.rst
- Style: (no style applied)
- Command: rst2pdf document1.rst
Document with Simple Styling
The same basic document with some styles added.
- PDF: document1-simple.pdf
- Content: document1.rst
- Style: simple.style
- Command:
rst2pdf --stylesheets=simple.style document1.rst document1-simple.pdf
Basic Presentation: Dark and Light Themes
Here is a simple sample presentation (inspired by https://github.com/akrabat/rst2pdf_example_presentation), with both dark and light styles. These could be a starting point for your own presentations.
- PDF: presentation1-light.pdf and presentation1-dark.pdf
- Content: presentation1.rst
- Style: light.style and dark.style (tip: the dark one also uses the built-in
fruity
stylesheet for code samples) - Command (light):
rst2pdf -s light.style -b1 presentation1.rst -o presentation1-light.pdf
- Command (dark):
rst2pdf -s dark.style,fruity -b1 presentation1.rst -o presentation1-dark.pdf
Code Samples
A document with a few code samples (pull requests to expand the set are very welcome) to show how to use the syntax highlight. You can use any of the built in styles or create your own!
- PDF: code1.pdf
- Content: code1.rst
- Command:
rst2pdf code1.rst
…. try using some of the built in stylesheets such asmurphy
,solarized-light
orxcode
to change the way the code looks.
Tip: to set the background, use the
backColor
directive in thecode
section of your style file.
Structured Document
This document has automatically numbered headings and a generated table of contents. These are ReStructuredText Directives, more info in the docs for that here: https://docutils.sourceforge.io/docs/ref/rst/directives.html#document-parts
- PDF: structured-document.pdf
- Content: structured-document.rst
- Command:
rst2pdf structured-document.rst