pdfize
v0.3.0
Published
CLI tool to convert HTML files to PDF
Readme
PDFize
CLI tool to convert HTML files to PDF.
Usage
npx pdfize -s index.html -o my-file.pdfDisable PDF shrinking (enabled by default):
npx pdfize -s index.html -o my-file.pdf --shrink=falseExclude Parts From PDF
You 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 --disableDefaultExclusionsAbout
PDF files are generated using Headless Chrome through Puppeteer, then shrunk using Alfred Klomp's shrinkpdf script.
