vivliostyle / vivliostyle.js

📖 The power of CSS typesetting, right at your fingertips.
https://vivliostyle.org
GNU Affero General Public License v3.0
603 stars 52 forks source link

Integrating Vivliostyle with Puppeteer to generate PDFs in a NestJS API #1155

Closed MathisPct closed 1 year ago

MathisPct commented 1 year ago

Hello 🙂,

I am working on a NestJS API project that receives an HTML template and generates a PDF file from a page opened via Chrome Headless using Puppeteer. I previously used Paged.js, which provides a JavaScript polyfill that I integrate into the HTML template in the Chrome page. Now, I would like to create a second route that supports the Paged Media specification but uses Vivliostyle instead.

I have installed the "@vivliostyle/core" dependency via npm, but I am having trouble integrating Vivliostyle with Puppeteer in my project.

Thank you in advance for your assistance :)

MurakamiShinyu commented 1 year ago

I recommend you to use Vivliostyle CLI. https://github.com/vivliostyle/vivliostyle-cli

Vivliostyle CLI uses Playwright (switched from Puppeteer last year).