You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found #855, #264, #269, and #1081. All of which seem related to the problem I am having.
Description of the problem
I want to make a pdf out of full page pngs which are data URIs. I want to run in a webworker and have compression so I cannot say which of the afforementioned issues is really to blame.
The problem is that performance is very bad. The problem seems to scale with number of pages. One page is "fast" (~1.5 seconds). Two pages is much slower. I recorded several data points (as many as patience granted).
These data were generated using the code below.
pages
time
1
1561.501953125ms
1
1581.448974609375ms
1
1658.505126953125ms
2
175932.03173828125ms
2
173780.81176757812ms
2
178272.82006835938ms
3
235536.85009765625ms
3
234518.7412109375ms
3
233301.33813476562ms
4
237735.68701171875ms
Code sample
constPDFDocument=require('pdfkit/js/pdfkit.standalone.js')constblobStream=require('blob-stream')onmessage=({ data })=>{constdpiScale=72/300letpdf=newPDFDocument({autoFirstPage: false})letstream=pdf.pipe(blobStream())data.forEach(c=>{pdf.addPage({size: "letter",}).image(c.dataurl,0,0,{width: c.size.width*dpiScale,height: c.size.height*dpiScale})deletepdf._imageRegistry[c.dataurl]// <- Got this from #1081})console.time('data')pdf.end()stream.on('finish',()=>{console.timeEnd('data')letblob=stream.toBlob('application/pdf')postMessage(blob)})}
Your environment
pdfkit version: 0.10.0
Node version: N/A
Browser version (if applicable): Google Chrome Version 80.0.3987.149 (Official Build) (64-bit)
Operating System: macOS Catalina 10.15.4
The text was updated successfully, but these errors were encountered:
Bug Report
I found #855, #264, #269, and #1081. All of which seem related to the problem I am having.
Description of the problem
I want to make a pdf out of full page pngs which are data URIs. I want to run in a webworker and have compression so I cannot say which of the afforementioned issues is really to blame.
The problem is that performance is very bad. The problem seems to scale with number of pages. One page is "fast" (~1.5 seconds). Two pages is much slower. I recorded several data points (as many as patience granted).
These data were generated using the code below.
Code sample
Your environment
The text was updated successfully, but these errors were encountered: