upvote
To test rendering correctness I use my own suite of about 100 PDFs that is a mix of research papers, proprietary CAD drawings from different people my father works with, technical specs, books, and few others. I compare rendering results from Pryzmera to MuPDF, and when the PDF doesn't contain a feature Pryzmera doesn't support, rendering is basically equal up to anti-aliasing differences. On my test suite nearly all PDFs render correctly, with a few that have minor differences (for example, images don't look identical at all zoom levels due to sampling, but the content is the same).

As for visual features Pryzmera currently doesn't support, the biggest one is probably shading; it's very rare in my test suite, but I will probably add support in the future, I just haven't got to it yet. Other visual features like paths, images, text, image masks and transparency are fully supported.

Lastly, I would like to add that fidelity is not absolutely everything: when you can't open a PDF, it doesn't help that it will eventually render correctly. Effectively you are not getting any render at all. Pryzmera does its best to render as close to the spec as possible, but is willing to sacrifice some visual fidelity (for example, by flattening curves into multiple line segments) in order to achieve orders of magnitude better performance. And if something does fail to render, it should appear in the logs, excluding bugs of course.

reply
Out of curiosity, how do you compare your rendering output to the ground truth rendering? It's probably a naive question but I have zero knowledge on this domain and I'm curious to learn!
reply
Very reasonable question!

On Pryzmera's side, the same way it renders to the window, it can render to an image file instead (PNG). On the "ground truth" side, I use mutool (based on MuPDF) to render the same PDF into another image file. Both renders are configured to use the same resolution, and then they can be compared pixel-by-pixel. Pixels are simply 3 numbers, representing the intensity of the red, green, and blue colors in the pixel. Each one of those can be directly compared to the same color in the other pixel by simply calculating their absolute difference (AKA |red1 - red2|). You can also use other functions here, like squared distance and such. All of the differences are summed to give you the error for each pixel, and then you can measure different metrics, like the pixel with the biggest error in the image, or the average pixel error for the image.

One note about "ground truth": When it comes to PDF rendering, the specification is incredibly long and complicated, which means there is basically not a single renderer that renders PDFs 100% correctly, even Acrobat likely has bugs. Thus, the output for each renderer is usually slightly different, especially around weird edge cases. For that reason, "whatever Acrobat does" has often times become the effective specification.

And if you have any other questions, please don't hesitate to ask!

reply