2

I am searching an alternative to latex.

The software should be used to create coloured invoices (PDF) for the gas and electricity industry.

I know that latex is great for math, but in this case it does not fit.

Latex is too clever and wants to do the things occurding to the latex rules.

But in my case I just want the output to look like the customer wants it to be.

Required features:

  • open source
  • Support for latin1
  • Support for unicode would be great
  • creates PDFs (DIN A4)
  • works on linux without gui
  • text based, not GUI based (libreoffice is not a solution)
  • Support for tables which span several pages. Table headers should occur on the second page again.
1
  • 1
    For JavaScript, I did all this and more, using the excellent, free, jsPdf Auto-table. If necessary, you could kludge that to run in a headless browser. Failing that, I am sure that the incomparable @SteveBarnes can recommend a Python module :-)
    – Mawg
    Commented Sep 19, 2018 at 7:28

3 Answers 3

2

CairoSVG

"Convert your SVG files to PDF and PNG."

homepage, source code: Python with some non-python library dependencies (e.g. cairo2), rendering engine: cairo2, license: LGPG-3.0

electron-pdf

"A command line tool to generate PDF from URL, HTML or Markdown files with electron."

source code: JavaScript, rendering engine: Chromium (Blink), license: MIT

WeasyPrint

"WeasyPrint is a smart solution helping web developers to create PDF documents. It turns simple HTML pages into gorgeous statistical reports, invoices, tickets…"

home page, docs, samples, source code: Python, license: BSD

wkhtmltopdf

wkhtmltopdf and wkhtmltoimage are open source (LGPLv3) command line tools to render HTML into PDF and various image formats using the Qt WebKit rendering engine. These run entirely "headless" and do not require a display or display service.

home page, command line (scripting) docs, source code: C/C++, rendering engine: WebKit, license: LGPLv3

Web Browsers, Headless

In the category of headless browsers, there are several candidates which could also be considered for HTML to PDF generation.

For example, ...

Chromium, Chrome

chromium-browser \
  --headless \
  --disable-gpu \
  --print-to-pdf="path/to/file01.pdf" \
  http://www.example.com/

### also works with a local file input URL
# file:///some/path/to/source_file.html

/Applications/Chromium.app/Contents/MacOS/Chromium \
  --headless \
  --disable-gpu \
  --print-to-pdf="some/path/file01.pdf" \
  file:///Users/username/Desktop/input.html
2
  • Thank you very much for these links. I just myself: Why are there no solutions based on the chrome rendering engine. Now that even microsoft will use it.
    – guettli
    Commented May 3, 2019 at 8:01
  • 1
    @guettli added some candidates which use the Chrome/Chromium rendering engine Blink. Commented May 3, 2019 at 19:54
1

Pandoc (https://pandoc.org/) will create PDFs from Markdown text and other formats. Sphinx (https://www.sphinx-doc.org/en/master/) is similar, but uses reStructuredText as input and is more customizable--you can define CSS to control layout, colors, and other style elements.

1

rinohtype* is a (pure) Python package that renders structured documents to PDF. The style of the PDF document is highly customizable by means of style sheets and document templates.

The primary input format for rinohtype is reStructuredText and Sphinx can be used to provide advanced authoring options.

* Full disclosure: rinohtype is developed by me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.