Automattic / Automattic/node-canvas
Missing async "canvas.toBuffer" for PDF canvases
- Dominant language
- JavaScript
- Stars
- 10.7k
- Forks
- 1.2k
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 1
Description
I need a progress bar for user-feedback because the pdfs i want to produce are huge and i am missing a indication for the time it takes.
600m x 3000mm for example, which means i want to fill 1000 x 1800 = 1.800.000 rectangulars with fillRect.
The problems starts when i want to write the buffer to a file, because toBuffer takes the unpredictable time. My hope was the async usage to get a more reactive way to save the buffer to a file.
## Issue
Callback function passed to toBuffer gets never called. Typos dont throw an error no console log.
## Steps to Reproduce
``` js
var Canvas = require('canvas');
let canvas = new Canvas(600, 600, 'pdf');
let ctx = canvas.getContext('2d');
ctx.fillStyle = 'rgb(0,0,0)';
// this runs in a for loop over 2 dim array with up to 2 milllion entries
ctx.fillRect(0,0,50,50);
console.log('start buffer');
canvas.toBuffer((err,buf) => {
// this never runs
console.log('foobar');
});
console.log('end buffer');
```
## Your Environment
- Version of node-canvas (^ 1.5.0): 1.6.0 should be installed
- Environment: node v6.5.0 on Mac OS X 10.11.6
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.