Create an A4 PDF from a local file using puppeteer-core
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
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)
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:
- Running with
npm exec
, like under quick start, is less effective offline - Manually installing packages, like under testing, is time consuming