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
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'sgoto()
method.There are several options available for the
waitUntil
parameter, includingload
,domcontentloaded
,networkidle0
, andnetworkidle2
. You can find detailed descriptions of these options here and a discussion in this GitHub issue.I changed the
waitUntil
value tonetworkidle0
, and this adjustment successfully resolved the problem, allowing the assets and fonts to load properly before generating pdf