Create PDF documents using web technologies


ReLaXed creates PDF documents interactively using HTML or Pug (a shorthand for HTML). It allows complex layouts to be defined with CSS and JavaScript while writing the content in a friendly, minimal syntax close to Markdown or LaTeX.

Here it is in action in the Atom editor:

And here are a few output examples:

Book – source PDF Letter – Source PDF Resume – Source PDF Visit card – Source PDF
Slides – Source PDF Report – Source PDF Paper – Source PDF Poster – Source PDF

ReLaXed has support for Markdown, LaTeX-style mathematical equations (via MathJax), CSV conversion to HTML tables, plot generation (via Vega-Lite or Chart.js), and diagram generation (via mermaid). Many more features can be added simply by importing an existing JavaScript or CSS framework.

Installing ReLaXed

Install ReLaXed via NPM with this command (do not use sudo):

npm i <span class="token operator">-</span>g relaxedjs

This will provide your system with the relaxed command. If the installation fails, refer to the troubleshooting page.

Getting started

To start a project, create a new document my_document.pug with the following Pug content:

h1 My document's title
p A paragraph <span class="token keyword">in</span> my document

Then start ReLaXed from a terminal:

relaxed my_document<span class="token punctuation">.</span>pug

ReLaXed will generate my_document.pdf from my_document.pug, then watch its directory and subdirectories so that every time a file changes, my_document.pdf will be re-generated.

It is also possible to generate the PDF file just once, with no sub-sequent file-watching, with this command:

relaxed my_document<span class="token punctuation">.</span>pug <span class="token operator">--</span>build<span class="token operator">-</span>once

Subscribe to the Newsletter

Get our latest news,tutorials,guides,tips & deals delivered to your inbox.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.