Show HN: Pryzmera – Fast PDF viewer fully rendering on the GPU
In September of 2021, my father told me he was struggling to open PDFs. As part of his job, he had to view many PDFs with millions of vector paths that were generated by CAD software, and we could not find any PDF viewer that would render them at more than a few frames per second. I thought that if we simply converted those paths into triangles the GPU could just blast through them. Today, after more than 5 years and 3 iterations in 3 different languages, I would like to share with you the 3rd iteration of my PDF viewer: Named "Pryzmera", I wrote it by hand with the goal to render those CAD PDFs at interactive frame rates, and with the intention to make every feature as fast as I could possibly imagine it to be. When Pryzmera opens a document, it first starts by interpreting each page. As a page is interpreted, it generates small clipping & tessellation jobs that run in parallel. Clipping & tessellation is performed by Pryzmera's own tessellator and produces the initial geometry for the page. This geometry is then collected and jointly optimized to produce a final GPU representation that mostly consists of colored/textured triangles. The representation is completely static, which in turn makes rendering performance (FPS) almost static, even when the view changes (e.g. panning/zooming/rotating). Once the representation is uploaded to the GPU, rendering a page typically requires only 3-4 draw calls. On my machine (GTX1080/i7-5820k), Pryzmera can render my father's CAD PDFs at hundreds (and sometimes thousands) of frames per second. Compared to Adobe Acrobat: - Loading is about 2-10x faster (depending on how Acrobat is feeling on the day) - Rendering is about 1200-5700x faster (depending on Pryzmera's graphics settings) - Text search is about 100x faster (although it's hard to measure Acrobat's performance here) - And this trend continues... If you would like to test the performance yourself, you can press F8 to bring up the render stats, including FPS and VRAM usage breakdown; You can try this stress-test file I made that is rather representative of the PDFs generated by CAD software: https://pryzmera.com/stress_test.pdf And if you are curious about any of the technical details, or anything else, ask away!
Discussion Highlights (18 comments)
maxloh
What do you use for conformance and regression testing? How much of a real-world PDF test suite can it render accurately? For a PDF viewer, fidelity matters much more than rendering speed. Imagine using it to open CAD PDFs as you suggested, only to realize a few months later that sections of some files silently failed to render, by which point the ship has sailed. Relying on a renderer maintained by a single person or even a small team carries significant risks. There are too many things that can go wrong. For example, pdf.js (which powers Firefox) uses a test suite with 1,579 files and growing: https://github.com/mozilla/pdf.js/tree/master/test/pdfs
p1mrx
$60 for a closed source PDF viewer, with 1 year of updates. I wish you good luck finding customers.
wewewedxfgdf
Is PDF performance a problem?
cvadict
> https://pryzmera.com/stress_test.pdf the stress test renders in < 3 seconds on my m5 max in pdfcraft (which is open source). Not sure I would ever pay $60 for a closed-source app to "speed it up," especially given how contrived that stress-test PDF is. > GTX1080/i7-5820k Yeah, there's your problem. Computers have gotten substantially faster in the last dozen years. I can't say I've felt that a PDF (regardless of how complex) has been slow during that time.
fnordsensei
I think this is great. A good example of classic hacker culture: you (or someone nearby) had a problem, and you wrote a solution. Kudos!
herf
The kerning (or inter-character spacing) looks a little rough compared to most viewers - is there more you could do to improve this?
jimjimjim
Does this use the MuPDF toolkit for pdf reading and processing? Is it opensource?
angry_octet
I stopped caring about fast pdf viewing some time ago. Now I only care about secure parsing and rendering. Signing and signature verification with something other than Acrobat would also be great.
aledamasmx
Adobe Digital Editions to read PDF and EPUB
mminer237
It looks very impressive. I mainly use simple PDFs, but Acrobat is indeed frustratingly slow just starting up without even rendering anything. I count six seconds to just open it on my computer without even opening a file. (Versus SumatraPDF, which is well under a single second.) I'm glad people are still trying to make things better. It's a great irony that as computers get faster and faster, software still manages to get slower and slower.
rootlocus
What language did you settle on and why?
layer8
> Activations are permanent and tied to a specific computer, and therefore cannot be transferred between computers. Sorry, but that is not acceptable for a perpetual license.
nathell
How does this compare to SumatraPDF?
emmilevesque
1200x faster PDF rendering than Acrobat is a compelling reason to switch - nice work
kphorn
I love that you built this and wish you luck. I do CAD and hardware engineering and am no stranger to big PDFs. As a benchmark, I have been using PDF XChange editor as it has a few great features that I rely on. - Fast - I was albe to load the stress test in about 15 seconds and can zoom. I looked and task manager doesnt report GPU usage but does show about 2-3% CPU on a 16c23t AMD Zen5 cpu - Annotations - I can do engineering annotations on it - add text, call outs, clouds, etc. A critical feature set for practicing engineers. Civil and landscaping especially have high need for annotations AND large pdfs. - Text editing/modifications - that's also built in so it's a nice addition. - There's plenty of competition: NitroPDF, PDF Xchange and others are probably your primary competition. Adobe is the gorilla but I avoid Adobe at all costs unless there's specifically a DRM'd PDF that requires acrobat with a plugin. I would certainly be interested in the GPU acceleration and getting more out of that.
ohmyYY
This looks really cool brother. Best of luck!
Waraqa
I was excited to learn about your software and to read this discussion. When I opened your website, I didn't expect it to be Windows-only. Do you have plans to release it for other operating systems?
ashkankiani
You mention mupdf (which is what I use as the basis for my wrapper around it) that you use as the comparison for testing. How does it compare to that? Also on a safety note, are you excluding the exploit vulnerable parts of PDF support?