Skip to content

maxwell-k/a4

Repository files navigation

REUSE status

a4

Create an A4 PDF from a local file using puppeteer-core

Quick start

Download a test HTML file:

curl -O http://example.org/index.html

Render the test HTML file to an A4 PDF called index.pdf:

npm exec --yes -- github:maxwell-k/a4 index.html

Testing

End to end test:

npm ci \
&& curl -s -O http://example.org/index.html \
&& node . index.html >/dev/null \
&& pdfinfo index.pdf | grep "^Page size:"

Expected output:

Page size:      594.96 x 841.92 pts (A4)

Offline / Single Executable Application

This is an experimental installation method using [Deno]:

deno compile --allow-env --allow-read --allow-write --allow-run --allow-net a4.js \
&& ./a4 --version \
&& cp a4 ~/.local/bin

Rationale:

  1. Running with npm exec, like under quick start, is less effective offline
  2. Manually installing packages, like under testing, is time consuming

Licence

Mozilla Public License Version 2.0