Images to PDF
Jun 11, 2020
AutoComic has been through many iterations each with its own challenges.
In each iteration, converting images into a pdf document has been an interesting problem.
Original Version
The original version of AutoComic (lost to time) was an AutoHotKey script. It manually simulated clicking on links and downloading images using a web browser and then pasted those image into a word processor. Needless to say, this was inefficient and buggy.
Bash Version
The bash version of AutoComic (which required creating a new script for each comic) used imagemagick. This command line tool can directly convert images to pdf files. This has a couple problems such as not allowing nicely formatted pages, not supporting consistent page size, and converting text to image before being added to a pdf.
Python (Current) Version
There are many packages for generating PDF documents with Python, but most were very hard to work with to get the flexibility needed. I eventually decided to use LaTeX to compile the pdf, which allows for a lot more customization with less code. Latex compilers can be difficult to set up, but the python code is much simpler than before. Since the script is outputting a human-readable LaTeX file, bugs are much easier to find and fix.