5 ms·
The discussion around this being a non-free standard encumbered with license restrictions makes me wonder: is there an alternative for pixel-perfect rich docume
by chrisshroba 4y ago
The discussion around this being a non-free standard encumbered with license restrictions makes me wonder: is there an alternative for pixel-perfect rich document rendering? HTML needs sandboxing to be safe, rtf is barebones, and .docx has external dependencies.
- herodotus 4y agoI worked on PDF for years, and yearned for a better way to render pixel perfect. I think that handling of lines, shapes and images could be drastically simpler, but, alas, handling Glyphs (characters/fonts) will always be a nightmare of complexity.
- wongarsu 4y agoThe obvious example would be PostScript. After all, PDF grew out of a desire to have a postscript variant better suited for digital documents instead of just printing. Illustrator's file format (.ai) was also just postscript up to version 8 or so.
- nayuki 4y agoIf you're describing an image format where all subobjects are bitmaps and not vectors, and all math is done with integers, then pixel perfection is possible. Once you introduce any mildly interesting vector or typesetting feature, you will not get pixel perfection. Examples: * You want to draw a circle. Antialiasing is desirable because jaggies look really ugly. Do you want to prescribe the exact antialiasing algorithm? What about other ones that are faster or more accurate? Which AA convolution kernel are you using - box, Gaussian, sinc? * Which approximation algorithm will you use to draw cubic Bézier curves? I don't think there is a closed-form solution for them. * You support affine transformations. Define a 10×10 square. Scale it by 1/100. Scale it by 100. What if, due to floating-point rounding errors, your square is now 9.999×9.999 and now renders to 9×9 pixels without antialiasing? * You support automatic text wrapping. One renderer uses float32, looks at how wide each word is, and decides to break at some point in the sentence. Another renderer uses float64, looks at how wide each word is, and decides to break at a different point in the sentence.
- layer8 4y agoPDF isn’t pixel-perfect (rounding and precision isn’t exactly specified). For literal pixel-perfectness, use PNG.
- mdaniel 4y agoI've only had tangential contact with it, but Wikipedia claims (https://en.wikipedia.org/wiki/DjVu#Format_licensing https://en.wikipedia.org/wiki/DjVu#Format_licensing) that DjVu is open, albeit they do talk about patents and I'm not qualified to say where that falls on the non-free spectrum I downloaded their example file and it's entirely binary, unlike PDF which is just pseudo-binary, but Evince did open it and it seems unlike PDF it's entirely raster based and would require a separate OCR layer on top of the text to make it eligible for copy-paste, if that's one of the goals
- yencabulator 4y ago> it seems unlike PDF it's entirely raster based and would require a separate OCR layer on top of the text to make it eligible for copy-paste, if that's one of the goals Not really all that different from PDF: "Like PDF, DjVu can contain an OCR text layer, making it easy to perform copy and paste and text search operations." https://en.wikipedia.org/wiki/DjVu https://en.wikipedia.org/wiki/DjVu DjVu however really does seem to be biased toward scanned-origin documents, not digitally produced ones.
- mdaniel 4y ago> Not really all that different from PDF That is not correct, PDF supports text spans natively; perhaps you're thinking of scanner software that merely uses PDF as a convenient packaging for their JPEGs? I cannot defend DjVu as I've only had tangential contact with it, and for sure have never tried to author any such file. I was just raising awareness that there are competing standards that appear to be libre and are designed for pixel perfect output
- GoblinSlayer 4y agoPixel-perfect is antipattern, document should be scalable, reflowable, restylable.