book-pdf-pagedjs

Convert Markdown manuscripts into print-style book PDFs and EPUBs using Paged.js.

366|90|Updated Aug 22, 2026
One-click install
npx skills add https://github.com/bam-bam-2/solo-skills --skill book-pdf-pagedjs-bam-bam-2
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: book-pdf-pagedjs
Source: https://github.com/bam-bam-2/solo-skills/tree/main/skills/book-pdf
Command: npx skills add https://github.com/bam-bam-2/solo-skills --skill book-pdf-pagedjs-bam-bam-2

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires playwright, and includes scripts (resource) components.

What problem does it solve? Plain Markdown-to-PDF conversion produces output that looks like a printed report, not a real book. This Skill builds a genuine book layout with a full-bleed cover, title page, copyright page, table of contents with real page numbers, chapter-start page breaks, and running headers on every page. ## Core Features & Use Cases - Paged.js Book Layout: Loads the Paged.js polyfill in Chromium to implement CSS Paged Media features like running headers and auto-generated TOC page numbers that Chromium does not support natively. - Documented Pitfall Workarounds: Encodes 12 known environment traps (ignored page size parameters, flexbox dropping in PDF output, Korean slug IDs breaking target-counter, async rendering polling) with concrete fixes. - Cover and Storefront Images: Generates brand-compliant covers and thumbnails for the 10000yearspen.com sales platform, including verified crop and safe-area dimensions. - Use Case: Turn a finished Markdown manuscript into a 152x225mm book PDF with TOC page numbers and running headers, plus an EPUB via pandoc and upload-ready cover/thumbnail images. ## Quick Start Convert my Markdown manuscript into a book-style PDF with a cover, table of contents with page numbers, and running headers using Paged.js.

Frequently Asked Questions about book-pdf-pagedjs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert Markdown to a book-style PDF with page numbers?

Convert the Markdown to HTML with pandoc, assign ASCII ids to headings, build a TOC using CSS target-counter for automatic page numbers, then render with the Paged.js polyfill in Chromium and export via page.pdf with preferCSSPageSize enabled.

What is Paged.js used for in PDF generation?

Paged.js is a polyfill that implements CSS Paged Media features Chromium lacks natively, such as running headers via string-set, named pages, and target-counter for table-of-contents page numbers. It is loaded as a script tag and renders asynchronously.

Why does page.pdf ignore my custom page size?

The width, height, and format parameters of page.pdf are ignored in some environments and output defaults to US Letter. Set preferCSSPageSize to true and declare the trim size in CSS with @page size, such as 152mm 225mm.

Why does flexbox content disappear in generated PDFs?

Horizontal flexbox layouts are dropped entirely by page.pdf, leaving blank regions in the output even though screenshots look correct. Replace horizontal flex layouts with display inline-block and vertical-align middle instead.

Can pandoc generate EPUB from Markdown?

Yes, pandoc handles EPUB generation directly with pandoc manuscript.md -t epub3 plus options for CSS, a cover image, and a table of contents. EPUB is reflowable, so page numbers and running headers are not needed.

Why does my Paged.js PDF render before content finishes loading?

Paged.js renders asynchronously, so calling page.pdf immediately captures an incomplete document. Poll the count of .pagedjs_page elements until it stays stable for several seconds before exporting the PDF.