Skip to content

PDF Compilation

Ruben Taelman edited this page Jun 2, 2021 · 5 revisions

Some organizations require you to submit your article as PDF. For this, there are several options.

Manual

With ScholarMarkdown, you can serve your article in a browser, and print your article to PDF using your browser's built-in print-mode. This works best in Firefox and Google Chrome.

Automatic

If you want automatic compilation to PDF, you can use chrome-headless-render-pdf to create PDFs from webpages via a convenient command-line script.

The following command will create an article.pdf file with A4 paper size assuming you are serving your article locally on port 3000 (default).

chrome-headless-render-pdf --url http://localhost:3000/ --pdf article.pdf --paper-width 8.27 --paper-height 11.69 --no-margins

If you want page numbers, the following is possible:

chrome-headless-render-pdf --url http://localhost:3000/ --pdf article.pdf --paper-width 8.27 --paper-height 11.69 --no-margins \
    --display-header-footer --header-template ' ' \
    --footer-template '<style type="text/css">.footer{font-size:8px;width:100%;text-align:right;color:#000;padding:0.65cm;}</style><div class="footer"><span class="pageNumber"></span> / <span class="totalPages"></span></div>'
Clone this wiki locally