- Source layout:
src/pdf/,src/handlebars/,src/types/,src/validation/,src/create/index.ts(createentrypoint); root keepsindex.tsonly. Published API unchanged. - Example (
example/):index.jsuses async/await, resolves output path withpath.join;template.htmlage field corrected ({{this.age}});npm startscript.
- README: AWS Lambda / serverless — deployment limits, container vs zip, memory and timeout, note that custom
executablePathis not exposed on options yet. - README: Margins (
border), custom fonts (hosted +base+@font-face), images (remote,base, data URLs, WebP, header/footer), page-break hints for wide tables. - GitHub Pages (
docs/): Fonts & images section and nav link; guide footer example aligned with v4 (single template); note on unsupported per-page footer keys; author section with social links.
- Rendering engine: PhantomJS /
html-pdfreplaced with Puppeteer (headless Chromium). Install footprint is larger (Chromium download onnpm install). PDF output may differ slightly from Phantom. - Types:
PdfCreateOptionsis now based onPdfRenderOptions(no dependency on@types/html-pdf).phantomPath,phantomArgs, and related fields are deprecated no-ops. - Footer
contents: only one repeating template is used —default, elsefirst, elselast. Per-page numeric keys (e.g. page2) are not applied.
src/pdfPuppeteer.ts:renderPdfToBuffer, mapping from options topage.pdf().htmlPdfTokensToPuppeteer()exported to map{{page}}/{{pages}}for print header/footer.PdfRenderOptions,PdfFileInfoinpdfRenderOptions.ts.
- Dependencies
html-pdf,@types/html-pdf.
- README: Strengths and trade-offs (Chromium vs PDFKit, footprint, when to scale).
pdfChromeonPdfCreateOptions: structured layout (format, orientation, size, border), header (htmlor escapedtitle), footer (htmlorcopyright+ optional page numbers viashowPageNumbers). Merged into html-pdf options; explicitformat/header/footeron the same object override.- Exported
buildPdfChrome()for building partial html-pdf options fromPdfChromeOptions. - Types:
PdfChromeOptions,PdfLayout,PdfHeaderConfig,PdfFooterConfig.
- Repository: removed root
yarn.lockso installs match npm only (aligned withnpm ciin CI). Keeppackage-lock.jsonas the lockfile. .gitignore: dropped the.package-lock.jsonignore rule (misleading;package-lock.jsonremains tracked).
- Example (
example/): sample usespdfChrome(layout, header title, footer copyright + page numbers). - GitHub Pages (
docs/): “Layout & header/footer” section, quick start usespdfChrome, install commandnpm i pdf-creator-node, hero link to full readme.
- Clear validation errors for missing
html,data, orpath(when writing a file). document.datacan be any value exceptnull/undefined(e.g.0is allowed).- Optional
handlebarsHelperson PDF options to register extra Handlebars helpers for that render (isolatedHandlebars.create()instance). - Stricter TypeScript types:
PdfDocumentFile,PdfDocumentBuffer,PdfDocumentStream, and aPdfDocumentunion. src/validation.tswithvalidatePdfDocument()(used internally).- Automated tests (
npm test) and GitHub Actions CI. engines.nodeset to>=18.
- Template compile/render errors are wrapped with prefix
pdf-creator-node: template rendering failed:. - README: corrected
ifCondHTML example, TypeScript usage, optional helpers, and license line (package.jsonlicenseset to MIT to matchLICENSE). package.jsonkeywords deduplicated.
See git history for changes before this changelog was added.