md2pdf Client
Introduction
md2pdf is a little project that aims to make it easy to produce
professional-looking PDF documents from Markdown files via a LaTeX template and
the help of Pandoc.
There are several motivations for this:
- Word processor software does not work very nicely with version control, plain-text Markdown files do
- Collaborating on a single ODT/DOC file is prone to overwriting others' work
- LibreOffice and Word both suck with automatic figure and table numbering on long files, and with TOCs etc
- It's painful trying to keep everyone using the right font, spacing, formatting, etc. when collaborating with ODT/DOC files
- PDF output from LibreOffice and Word often looks pretty average
- It's distracting having to worry about formatting while writing - Markdown takes away all but the most basic formatting options to focus you on writing
With with an appropriate template, LaTeX PDF output is undeniably the prettiest-
looking way to create documents. But, learning LaTeX is hard. Markdown
is much easier to use, and when used with Pandoc can still produce superb PDF
documents. md2pdf makes it simple to manage having the right LaTeX templates and
configuration across a whole team, by using a central server to do the PDF
generation and then share the result with those who need it.
Client application
This simple Python program is the md2pdf client application. It is intended to
be used with an md2pdf-webserver
instance, running locally or remotely.
See the md2pdf-webserver hompage for more information
Usage
Usage is quite simple, run md2pdf-client -h
for more information:
md2pdf client v1.3.0 - connect to an md2pdf server and create a PDF file
positional arguments:
FILEPATH Input Markdown file to be converted
optional arguments:
-h, --help show this help message and exit
-c FILEPATH, --compare FILEPATH
Activates 'compare' mode. Specify the file to compare
changes with, e.g.: 'md2pdf-client --compare
path/file-old.md path/file-new.md'
--set-default OPTION VALUE
Change a default value for an option. Use the full
argument name, separated by a space, e.g.: '--set-
default proto https' or '--set-default server
192.168.1.1:9090'
-s ADDRESS[:PORT], --server ADDRESS[:PORT]
Server address to request PDF generation from. Use
hostname or IP address, and port number if required
(i.e. '127.0.0.1:9090', or 'my-host.com:8888'). If
port is not specified, port 80 will be used
--proto {http,https} Protocol to use
-t TEMPLATE, --template TEMPLATE
Template to use, instead of the server default
(include the file extension)
Usage hints
- Don't forget to set a default port when you set the default server! You probably won't be using port 80, so make sure you set it correctly, with something like
md2pdf-client --set-default server 1.2.3.4:9090
or md2pdf-client --set-default server hostname.tld:9090
. Don't include the protocol here. md2pdf-webserver
by default doesn't do HTTPS - but it would be possible to put it behind a HTTPS reverse proxy. If that is the case, don't forget to set the default protocol with md2pdf-client --set-default proto https
- If you use the
--template
option, don't forget that the template must also exist in the server - you can't use a local template (at least not yet). - If something doesn't work on the server end, you should get a
.log
file in the same directory as your input Markdown file - take a look in there for more information. - If something doesn't work on the client end, it can be helpful to run
md2pdf-client
from the command line to check the output. - Compare mode can only be used from the command-line, it won't show up in the "Open With" menu. Use the flag
--compare
followed by the path to the old version, then the path to the new version. The output PDF will be in the location of the new Markdown version. Images are removed in compare mode.
Installation
PyPi
md2pdf-client
is available through the Python Package Index (PyPi), it can be installed through pip
:
$ python3 -m pip install md2pdf-client
This should work on Linux, Windows, and OS X (and really anywhere that Python 3 can run)
Snap Package
md2pdf-client
is available as an Ubuntu Snap package. You can install it with :
$ sudo snap install md2pdf-client
The packaging is done automatically by Launchpad, based on the Snapcraft config in this repo.
Direct Python script
md2pdf-client
can also be run as a Python script (typically only needed during development):
python3 -m md2pdf_client.md2pdf_client -f <file>
License
This project is released under the terms of the GNU Affero GPL version 3 (or
later). Please see LICENSE for details.
Thanks
The base of my (very crappy) icon is from the standard GNOME icons. These are GPL licensed.