service converting markdown to PDF

Usage no npm install needed!

<script type="module">
  import cepharumPdfMaker from 'https://cdn.skypack.dev/@cepharum/pdf-maker';


PDF Maker

converting Markdown to PDF




This tool is combining markdown-it with pdfmake using Hitchy to expose a markdown-to-PDF converter via REST-like API.


When exposing this service at, sending a POST request to

is generating PDF document named test.pdf. The resulting document isn't stored on server, but instantly sent to requesting client in response.

The request needs to provide content to be rendered. Provide information in JSON-encoded request body describing with property content providing content of resulting document as Markdown-encoded string. In addition, a second property named theme is optionally providing styling information mostly forwarded to pdfmake. See the following example:

    "content": "# Title\n\nThis is some Markdown text including:\n\n* a list\n* with two items.",
    "theme": {
         "defaultStyle": {
             "fontSize": 11
         "pageSize": "A4",
         "styles": {
             "p": {
                 "marginTop": 11
             "ul": {
                 "marginTop": 11
             "ol": {
                 "marginTop": 11
             "h1": {
                 "marginTop": 36,
                 "fontSize": 36
             "h2": {
                 "fontSize": 24,
                 "marginTop": 10
             "h3": {
                 "fontSize": 20,
                 "bold": true,
                 "italics": true,
                 "marginTop": 10

How it works

By combining markdown-it with pdfmake, this application is parsing some provided markdown text converting resulting hierarchy of tokens into content definition suitable for use with pdfmake. In addition, an extended engine is processing styling definitions in provided theme injecting pdfmake-compatible styling definitions as well as adjusting resulting content definitions.


The service is available as a docker container.

docker run --rm -p 3000:3000  cepharum/pdf-maker

This command is running pdf-maker. When started, open in your browser. This will load a simple page providing editor for generating PDF documents from markdown content and JSON styling.