Pragmatism in the real world

Background images and multiple styles in rst2pdf

Over the weekend I released rst2pdf 0.99. The list of changes is quite long as it's been over a year since the last release. There are some key things in this release that I'm particularly pleased about including Python 3.9 and 3.10 & Sphinx 4 support, multiple styles in the class directive and the ability to specify background images in the raw:: pdf directive. There's also a number of bug fixes, particular to math rendering… continue reading.

A logo for rst2pdf

All projects seem to have a logo these days, so I asked my friend Jane of iD to create a logo for rst2pdf and she came up with this: This met what I was looking for with a clear design that is related to the what the application does, so thank you Jane. I've set the profile icon for the GitHub organisation and Twitter accounts and we'll be using this in other places as we… continue reading.

Cannot find zlib headers on macOS 10.15 Catalina

My new MacBook Pro 16" comes with Catalina and while setting up Python to develop rst2pdf, I discovered that Pillow wouldn't install. Running setup.py install for pillow … error ERROR: Command errored out with exit status 1: Looking through the long list of red text I came across: The headers or library files could not be found for zlib, a required dependency when compiling Pillow from source. Aha! The way this was solved on the… continue reading.

Creating virtual environments with Pyenv

rst2pdf is a Python 2 application that we're making compatible with Python 3. When developing Python applications, I've found it useful to be able to switch python versions easily and also set up clean environments to work in. To do this, I currently use pyenv. This is how I set it up: Install Pyenv On my Mac, I install pyenv & its sister project pyenv-virtualenv with Homebrew: $ brew install readline xz $ brew install… continue reading.

Step debugging sphinx-build in PyCharm

I've been trying to solve an issue with the rst2pdf Sphinx extension which allows you to use rst2pdf to create a PDF of your Sphinx documentation rather than using Sphinx's default pdfTeX builder. In order to understand what was happening, I really wanted to inspect variable at certain stages of the process, which is easiest with a step debugger. As I already use PhpStorm for step debugging PHP, I fired up PyCharm and worked out… continue reading.

rst2pdf: back from the dead!

Today marks a momentous day! I've released 0.94 of rst2pdf to PyPI! If you have a need to convert plain text files to PDF, check it out. As the last release, 0.93, was December 2012, I think you could have reasonably assumed that the project was abandoned. So why did I bring it back from the dead?

Automatically converting PDF to Keynote

I use rst2pdf to create presentations which provides me with a PDF file. When it comes to presenting on stage, on Linux there are tools such as pdfpc and on Mac there's Keynote. Keynote doesn't read PDF files by default, so we have to convert them and the tool I use for this is Melissa O'Neill's PDF to Keynote. This is a GUI tool, so I manually create the Keynote file when I need it… continue reading.

Auto reloading a PDF on OS X

Currently, I create presentations using rst2pdf and so I regularly have vim open side by side with the Preview app showing the rendered PDF. I use a Makefile to create the PDF from the rst sources, so I just use :make in vim to rebuild the PDF file and then had to switch to Preview in order for it to reload the updated PDF file. Recently a friend wondered why the PDF viewer couldn't reload… continue reading.

Styling rst2pdf tables

I currently use rst2pdf to create presentations slide decks from reStructured Text files. I like rST a lot as it's more expressive than Markdown and allows for extension. Tables in rST are marked up like this: +———–+———–+———–+ | Heading 1 | Heading 2 | Heading 3 | +===========+===========+===========+ | a | b | c | | | | | | aa | | | +———–+———–+———–+ | d | e | f | +———–+———–+———–+ | g… continue reading.

Jerry-rigging pygments to support new PHP keywords

I use rst2pdf to create my presentations and noticed that the syntax highlighter wasn't highlighting instanceof. rst2pdf uses pygments for syntax highlighting, so I wondered what was going on. A short investigation led to me realise that the current stable version of pigments is 1.6 and they are working on 2.0. It seems that 2.0 has a number of changes to the PHP lexer, which aren't in 1.6. While I'm waiting, I modified my local… continue reading.