CLI tool to convert HTML files to PDF.
npx pdfize -s index.html -o my-file.pdf
Disable PDF shrinking (enabled by default):
npx pdfize -s index.html -o my-file.pdf --shrink=falseYou can remove specific sections from the generated PDF without editing the source file.
- Use built-in conventions in your HTML:
.no-pdf[data-pdf-exclude="true"]
- Or pass custom CSS selectors with
--exclude(repeatable):
npx pdfize -s index.html -o my-file.pdf \
--exclude ".sidebar" \
--exclude "#debug-panel"- Disable built-in exclusions when needed:
npx pdfize -s index.html -o my-file.pdf --disableDefaultExclusionsPDF files are generated using Headless Chrome through Puppeteer, then shrunk using Alfred Klomp's shrinkpdf script.