Hacker News new | past | comments | ask | show | jobs | submit login

That's a good point, and it took me a bit of trials to force Chrome to print canvas in vector. The article links to the MDN <canvas> demo [1], which doesn't print in vector if you try it. But you can run the following in the console and then try to print the same page, which will be vectorized:

    window.onbeforeprint = () => {
        window.canvas.width |= 0; // clear the canvas
        draw();
    };
So I guess, for now, this behavior only manifests when you use the beforeprint event.

[1] https://yari-demos.prod.mdn.mozit.cloud/en-US/docs/Web/API/C...




Thanks a lot! Just a little typo: it should be `onbeforeprint` I guess. I just checked and it works. That approach has a potential to solve important problem for me.


Oh, I had a trouble in spelling "print" vs. "paint" ;-) (Fixed.) I now wonder why Blink specifically supports this, presumably to support some weird websites?




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: