4 ms·
It's a good thought, and it does seem a much better way to go at face value. However, I strongly suspect there are good technical reasons why you basically need
by benhoyt 12y ago
It's a good thought, and it does seem a much better way to go at face value. However, I strongly suspect there are good technical reasons why you basically need to use canvas, to get the complete, pixel-perfect control over the layout and font rendering that you'd need for PDFs.
- userbinator 12y agoto get the complete, pixel-perfect control over the layout and font rendering that you'd need for PDFs. I suspect this is part of the problem too - the desire to render every pixel of fonts the same as the native application. But honestly, 99.9% of the time I'm reading a PDF, I don't care if each pixel is in exactly the same place as it would be in some other reader application so long as I can read the content, and would be willing to sacrifice that if it meant a drastic decrease in memory consumption (and possibly better performance.) That doesn't mean a "precise mode" is a bad idea, so maybe make this an option - you can either have pixel-perfect rendering but use more memory and CPU, or have a "close enough" rendering that doesn't.
- masklinn 12y agoIf you don't care you should feel free to replace pdf.js with a degraded version, but I'd expect something which claims to render PDFs to actually do that.
- mhaymo 12y agoSeems to me that the development time spent maintaining two different modes might be better spent simply improving the efficiency of the one correct version.
- jerf 12y ago"But honestly, 99.9% of the time I'm reading a PDF, I don't care if each pixel is in exactly the same place as it would be in some other reader application so long as I can read the content" No, you don't actually want that. I've seen this in Linux where a PDF gets rendered with the wrong font because the correct one wasn't on my system or embedded in the PDF. It becomes illegible. PDFs are deeply pixel perfect in specification; you can't just decide to not worry about that anymore and expect anything legible to come out the other side. It is not HTML under the hood; it's a printer format under the hood.
- nnethercote 12y agoSpot on. Pixel-perfection is probably the single most compelling thing about PDF, and it certainly is a fundamental design goal of pdf.js.