Skip to content

Commit 1732f33

Browse files
committed
Release 4.0.0
1 parent de43a54 commit 1732f33

14 files changed

Lines changed: 2236 additions & 1246 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v4
1818

19+
- name: Cache Puppeteer Chromium
20+
uses: actions/cache@v4
21+
with:
22+
path: ~/.cache/puppeteer
23+
key: ${{ runner.os }}-puppeteer-${{ hashFiles('package-lock.json') }}
24+
1925
- name: Use Node.js ${{ matrix.node-version }}
2026
uses: actions/setup-node@v4
2127
with:

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
# Changelog
22

3+
## [4.0.0] — 2026-04-03
4+
5+
### Breaking
6+
7+
- **Rendering engine:** **PhantomJS / `html-pdf` replaced with [Puppeteer](https://pptr.dev/) (headless Chromium).** Install footprint is larger (Chromium download on `npm install`). PDF output may differ slightly from Phantom.
8+
- **Types:** `PdfCreateOptions` is now based on **`PdfRenderOptions`** (no dependency on `@types/html-pdf`). **`phantomPath`**, **`phantomArgs`**, and related fields are deprecated no-ops.
9+
- **Footer `contents`:** only one repeating template is used — **`default`**, else **`first`**, else **`last`**. Per-page numeric keys (e.g. page `2`) are not applied.
10+
11+
### Added
12+
13+
- **`src/pdfPuppeteer.ts`:** `renderPdfToBuffer`, mapping from options to `page.pdf()`.
14+
- **`htmlPdfTokensToPuppeteer()`** exported to map `{{page}}` / `{{pages}}` for print header/footer.
15+
- **`PdfRenderOptions`**, **`PdfFileInfo`** in `pdfRenderOptions.ts`.
16+
17+
### Removed
18+
19+
- Dependencies **`html-pdf`**, **`@types/html-pdf`**.
20+
21+
### Documentation
22+
23+
- README: **Strengths and trade-offs** (Chromium vs PDFKit, footprint, when to scale).
24+
325
## [2.5.0] — 2026-04-03
426

527
### Added

docs/assets/css/style.css

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,89 @@ pre code {
495495
max-width: 52ch;
496496
}
497497

498+
.author-section .author-card {
499+
max-width: 40rem;
500+
padding: 1.35rem 1.5rem;
501+
background: var(--surface);
502+
border: 1px solid var(--border);
503+
border-radius: var(--radius);
504+
box-shadow: 0 1px 3px var(--shadow);
505+
}
506+
507+
.author-card__name {
508+
margin: 0 0 0.35rem;
509+
font-size: 1.25rem;
510+
font-weight: 700;
511+
letter-spacing: -0.02em;
512+
color: var(--text);
513+
}
514+
515+
.author-card__role {
516+
margin: 0 0 0.75rem;
517+
color: var(--muted);
518+
font-size: 0.98rem;
519+
}
520+
521+
.author-card__contact {
522+
margin: 0 0 1rem;
523+
font-size: 1rem;
524+
}
525+
526+
.author-social {
527+
display: flex;
528+
flex-wrap: wrap;
529+
gap: 0.5rem 0.75rem;
530+
margin: 0;
531+
padding: 0;
532+
list-style: none;
533+
}
534+
535+
.author-social__link {
536+
display: inline-block;
537+
padding: 0.4rem 0.85rem;
538+
font-size: 0.92rem;
539+
font-weight: 600;
540+
color: var(--accent);
541+
background: rgba(91, 156, 245, 0.1);
542+
border: 1px solid rgba(91, 156, 245, 0.25);
543+
border-radius: var(--radius-sm);
544+
text-decoration: none;
545+
transition:
546+
color 0.15s ease,
547+
background 0.15s ease,
548+
border-color 0.15s ease;
549+
}
550+
551+
.author-social__link:hover {
552+
color: var(--accent-hover);
553+
background: rgba(91, 156, 245, 0.16);
554+
border-color: rgba(91, 156, 245, 0.4);
555+
text-decoration: none;
556+
}
557+
558+
html[data-theme="light"] .author-social__link {
559+
background: rgba(37, 99, 235, 0.08);
560+
border-color: rgba(37, 99, 235, 0.2);
561+
}
562+
563+
html[data-theme="light"] .author-social__link:hover {
564+
background: rgba(37, 99, 235, 0.12);
565+
border-color: rgba(37, 99, 235, 0.35);
566+
}
567+
568+
.author-card__note {
569+
margin: 1rem 0 0;
570+
padding-top: 1rem;
571+
border-top: 1px solid var(--border);
572+
font-size: 0.88rem;
573+
color: var(--muted);
574+
line-height: 1.5;
575+
}
576+
577+
.author-card__note code {
578+
font-size: 0.85em;
579+
}
580+
498581
.steps {
499582
list-style: none;
500583
margin: 0;

docs/index.html

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<a href="#guide">Guide</a>
3636
<a href="#pdf-chrome">Layout &amp; header/footer</a>
3737
<a href="#ifcond">ifCond</a>
38+
<a href="#author">Author</a>
3839
</nav>
3940
<div class="site-header__actions">
4041
<button
@@ -57,7 +58,7 @@
5758
<main id="main" class="main">
5859
<div class="wrap">
5960
<header class="hero">
60-
<p class="hero__eyebrow">Node.js · Handlebars · html-pdf</p>
61+
<p class="hero__eyebrow">Node.js · Handlebars · Puppeteer (Chromium)</p>
6162
<h1>pdf-creator-node</h1>
6263
<p class="tagline">
6364
Turn HTML templates into PDFs — write templates with Handlebars, get a
@@ -228,8 +229,9 @@ <h2 id="guide-heading">Step-by-step</h2>
228229
<div class="section__head">
229230
<h2 id="pdf-chrome-heading">Layout, header, footer, copyright</h2>
230231
<p class="section__lede">
231-
Use <code>pdfChrome</code> on the second argument for paper size, repeating
232-
header (<code>title</code> or <code>html</code>), and footer with optional
232+
v4 uses <strong>Puppeteer</strong> (Chromium), not PhantomJS. Use
233+
<code>pdfChrome</code> on the second argument for paper size, repeating header
234+
(<code>title</code> or <code>html</code>), and footer with optional
233235
<code>copyright</code> and page numbers (<code>{{page}}</code> /
234236
<code>{{pages}}</code>). Plain strings are HTML-escaped. Direct
235237
<code>format</code> / <code>header</code> / <code>footer</code> on the same
@@ -255,8 +257,7 @@ <h2 id="pdf-chrome-heading">Layout, header, footer, copyright</h2>
255257
<p class="steps__text">
256258
For full control, pass <code>header</code>, <code>footer</code>, and
257259
<code>format</code> in the same options object as
258-
<a href="https://www.npmjs.com/package/html-pdf">html-pdf</a> expects (see
259-
readme).
260+
<a href="https://pptr.dev/">Puppeteer</a> PDF options (see readme).
260261
</p>
261262
</section>
262263

@@ -287,21 +288,62 @@ <h2 id="ifcond-heading"><code>ifCond</code> helper</h2>
287288
</aside>
288289
</section>
289290

291+
<section id="author" class="section author-section" aria-labelledby="author-heading">
292+
<div class="section__head">
293+
<h2 id="author-heading">Author</h2>
294+
<p class="section__lede">
295+
Maintainer of this package — questions and contributions welcome on GitHub.
296+
</p>
297+
</div>
298+
<div class="author-card">
299+
<p class="author-card__name">Shyam Hajare</p>
300+
<p class="author-card__role">Open-source maintainer · Node.js &amp; PDF tooling</p>
301+
<p class="author-card__contact">
302+
<a href="mailto:hajareshyam@gmail.com">hajareshyam@gmail.com</a>
303+
</p>
304+
<ul class="author-social" aria-label="Author social and profiles">
305+
<li>
306+
<a
307+
class="author-social__link"
308+
href="https://github.com/hajareshyam"
309+
rel="noopener noreferrer me"
310+
>GitHub</a
311+
>
312+
</li>
313+
<li>
314+
<a
315+
class="author-social__link"
316+
href="https://www.npmjs.com/package/pdf-creator-node"
317+
rel="noopener noreferrer"
318+
>npm package</a
319+
>
320+
</li>
321+
</ul>
322+
<p class="author-card__note">
323+
To add LinkedIn, X (Twitter), Mastodon, or other links, edit
324+
<code>docs/index.html</code> and duplicate a line inside
325+
<code>&lt;ul class="author-social"&gt;</code>.
326+
</p>
327+
</div>
328+
</section>
329+
290330
<footer class="site-footer">
291331
<div class="site-footer__links">
292332
<a
293333
href="https://github.com/hajareshyam/pdf-creator-node/blob/master/LICENSE"
294334
>License</a
295335
>
296-
<a href="https://github.com/hajareshyam/pdf-creator-node">GitHub</a>
297-
<a href="https://www.npmjs.com/package/pdf-creator-node">npm</a>
336+
<a href="https://github.com/hajareshyam/pdf-creator-node">Repository</a>
337+
<a href="https://www.npmjs.com/package/pdf-creator-node">npm package</a>
338+
<a href="https://github.com/hajareshyam">Author on GitHub</a>
298339
<a
299340
href="https://github.com/hajareshyam/pdf-creator-node/edit/master/docs/index.html"
300341
>Edit this page</a
301342
>
302343
</div>
303344
<p class="site-footer__meta">
304-
<strong>pdf-creator-node</strong> · Shyam Hajare
345+
<strong>pdf-creator-node</strong> ·
346+
<a href="#author">Shyam Hajare</a>
305347
</p>
306348
</footer>
307349
</div>

example/package-lock.json

Lines changed: 10 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)