webpro / reveal-md

reveal.js on steroids! Get beautiful reveal.js presentations from any Markdown file
MIT License
3.74k stars 416 forks source link

fix(print-pdf): wait untill all resources are loaded #466

Closed moleus closed 11 months ago

moleus commented 11 months ago

I encountered an issue with the loading of js assets and custom fonts when attempting to generate a PDF. This resulted in either empty or poorly formatted pdf. Upon investigation, I determined that the problem was related to the waitUntil option of Puppeteer's goto() method.

There are several options available for the waitUntil parameter, including load, domcontentloaded, networkidle0, and networkidle2. You can find detailed descriptions of these options here and a discussion in this GitHub issue.

I changed the waitUntil value to networkidle0, and this adjustment successfully resolved the problem, allowing the assets and fonts to load properly before generating pdf

webpro commented 11 months ago

This is great! Thanks for the investigation and the fix 👌