top | item 27968900

Lessons learned from 15 years of SumatraPDF, an open source Windows app

350 points| archimag0 | 4 years ago |blog.kowalczyk.info | reply

133 comments

order
[+] approxim8ion|4 years ago|reply
Sumatra, alongside maybe Everything and IrfanView, is my favorite piece of software on windows. Incredible speed, great customizability and awesome compatibility.

I really missed it when I made the switch to Linux, but not enough to consider installing WINE. Still, absolutely wonderful project deserving of the highest praise.

[+] Multicomp|4 years ago|reply
Big kudos to the author for not getting sucked into the Electron Maelstrom. I find it so interesting that fancy MVU style Elm web UI event loops etc. all just reinvent the message loop that Windows has used since Win95.

My PDF journey went from Adobe to Foxit to Firefox to SumatraPDF to Okular.

I chose Okular over SumatraPDF because it does form fills and saves said form fill data to a new PDF. (Sumatra may do form fills now, IDK)

I never would have tried Ocular if I wasn't on Fedora KDE, Sumatra was good enough, and I just fell back to FF when I had to do form fills (then print via CutePDF).

Now that Okular is just a 'choco install okular' away from having it on Windows as well as Linux, I get application consistency, form-fills that save modified PDF files, and annotation stuff.

But for Grandma? SumatraPDF it is.

[+] hexomancer|4 years ago|reply
There is a new open source PDF viewer called sioyek that has many of the features of sumatra and has experimental linux builds.

https://sioyek.info/

(Disclaimer: I am the developer of sioyek)

[+] krylon|4 years ago|reply
Paint.NET is great, too. It's not open source, unfortunately (for valid if regrettable reasons), but it's free as in free beer. The memory of its GUI makes me sigh a little whenever I open GIMP.
[+] rand49an|4 years ago|reply
I'd add Bvckup 2 to that list. Simply a application for copying/mirroring directories but is quick with a simple UI despite having lots of options.

Bought a license years ago but still use it daily.

[+] toastercat|4 years ago|reply
There really is an abundance of high quality, and performant open-source applications on Windows. Among the three you've listed, I can also mention Notepad++, JPEGView, MPC-HC, Scoop.sh, and ShareX.
[+] radmuzom|4 years ago|reply
Agreed. And it's written in the native Win32 API. I personally find native Win32 apps much more usable with better UI/UX than most "modern" frameworks.
[+] MeinBlutIstBlau|4 years ago|reply
I love Sumatra too. I dislike there is no dark mode so I just used inverted colors and it has worked well. Super lightweight and simple. Unlike adobe which is bloated, slow, and annoying.
[+] throwawaysea|4 years ago|reply
I wasn't aware of Everything - seems interesting. Are there equivalents to these that you like on Linux?
[+] qalmakka|4 years ago|reply
I personally like Okular a lot, I also like to use it on Windows (it's in the Windows store).
[+] nolroz|4 years ago|reply
What's wrong with WINE?
[+] zamadatix|4 years ago|reply
It's amazing to see the drive of "I know what I want to make and I do it the way I want" carry the project for so long. More than any development ideology just having the passion to continue working on whatever it is you're doing is an extremely powerful force for creating useful software. And SumatraPDF is definitely useful software, has been for a long time.

"ideology doesn't matter as much as doing" being said the syntax valid semantic invalid error at the end of this excerpt in the section on extensive tests being overrated gave me a chuckle:

> Dogma is powerful. Sometimes in my corporate life I felt like writing tests was just going through motion. Maybe we should spend more time writing code instead, I though?

In all seriousness I agree though. In a project where you write the majority of the code it is possible to overdo tests in a way that you are wasting more time than you're saving yourself and in a passion project efficiency isn't always as important as interest anyways.

[+] optionist|4 years ago|reply
I registered a HN account just to comment on this. Thank you so much for writing this small yet powerful software. I used it in grad school when I needed to write paper with latex and compile it with pdflatex. 2 features are killers: 1. auto reload the newly generated pdf. 2. double click on pdf and it jumps to the corresponding place in the tex file. It was such an productivity booster. Thank you!
[+] SamuelAdams|4 years ago|reply
This app has gotten me through so many days of undergrad. It's one of the only windows apps that can handle textbook-sized pdfs well. I can search on text quickly too, while Adobe Reader can barely open any PDF larger than 100 pages.
[+] Loranubi|4 years ago|reply
I have been using SumatraPDF on Windows for a long time. After opening a PDF file with it for the first time, I never went back to Adobe Reader. SumatraPDF is much faster, cleaner and less memory hungry.
[+] michaelcampbell|4 years ago|reply
Other readers likely have this feature, but one I love is that you can re-generate the PDF out from under it and it reloads the new content. As someone writing in LaTeX on emacs and constantly re-generating the PDF, this is very helpful.
[+] robtherobber|4 years ago|reply
My comment is bound to be redundant in this thread, but so have I. SumatraPDF is an excellent piece of software that has made life for countless people easier and without them having to pay anything in exchange.

It's as simple as it gets (with a UI), it's fast, robust and reliable. I wish governments would set aside some generous budgets for this type of projects that are consistently useful and reliable, like they do for arts and education (well, some governments).

[+] Leparamour|4 years ago|reply
Same experience here.

It's one the first programs I install on every new system and have recommended it to friends for years.

If any of the programmers involved read here: Thank you very much for all the hard work. It was worth it.

[+] tolai|4 years ago|reply
Same experience. Great piece of software, been using it for a long time as well. THANK YOU SO MUCH !
[+] Markoff|4 years ago|reply
tried it for some time, but quickly moved away since it had problems with rendering, comments and I need to highlight and annotate PDFs, also ocasionally I sign there documents with my transparent GIF signature, I don't think sumatra can do any of these

but I am adobe hater, didn't use their software for decades, now I am using for years Foxit reader

[+] b3lvedere|4 years ago|reply
Totally agree. SumatraPDF is an awesome reader. Been using it for many years.
[+] krylon|4 years ago|reply
I agree 100%, it is awesome. Also, it remembers the position in a file.
[+] ufmace|4 years ago|reply
Upvoted for a number of interesting and unconventional opinions.

Rolling your own JSON, XML, etc parsers raises some eyebrows. I guess it's sort of okay if you expect to only be reading your local config files versus arbitrary web content. Maybe then it's okay to trade off raw speed for not handing a ton of formatting and syntax edge cases.

Writing GUI apps against the native framework. Yup, it'll be a major pain to ever port to another platform. But if you don't care to do that, nothing's as fast and clean both to develop and for the end-user to use as every platform's native framework.

Unit tests are sometimes overrated. IMO, they're much more suited to building apps in dynamic languages. Unit tests are a lot less important if you have a good type system and compiler checking things already. I've heard it described before that half of the benefit of unit testing in these languages is forcing yourself to structure code in testable modules with clean interfaces. But if you can just do that anyways, the actual tests are less important.

[+] jstimpfle|4 years ago|reply
I think writing a JSON parser should be perfectly fine, it's quite a simple format (while imperfect and probably way overused). I would say 50 lines of header + 500 lines of .cpp file should be plenty to write a solid reusable implementation that parses to a generic tree (dicts, lists, float/string/bool literals). Should be doable in an afternoon.

But if you disagree, you should try a particular, very popular JSON library for C++ (removed the mention of the name here, you can figure it out on your own if you want).

Last I checked, a git clone of this library downloaded 260 Megabytes of data. The project consists of many many files, but most notably it is a C++ header-only library consisting of 24000 lines of header files to be included into every (transitively) dependent .cpp file.

When you run "g++ -E" on it (to do the preprocessing step only) those 24000 lines will unfold to about 84000 lines.

Just write a short test.cpp with #include <THIS JSON LIBRARY.h> in it and add a int main() { printf("Hello, world\n"); }. Compiling this with "g++ -c" takes about 1 sec on my laptop.

Add a tiny amount of code that "parses" the string literal "3" (which I think is not valid JSON actually. But anyway) and compile + link. Takes 2 secs on my laptop. With -O2, I'm at 3.5 seconds.

Imagine writing a larger project with many many .cpp file that include a header file that publishes such a dependency. Or just imagine compiling a project where multiple .cpp files directly include this thing.

It's a truly sad time to be a programmer.

[+] arthur2e5|4 years ago|reply
Regarding the XML thing the author did mention later how complex a compliant parser is, so presumably tests have been… done. The “HTML/” before the XML is what really raised my eyebrows with the stuff, since not many people besides browsers implement the optional tag and tag soup recovery right. (At least it’s standardized in the spec now.)

Alright, looks like the self-brewed parser is explicitly for CHM HTML4 and EPUB XHTML only, with the more serious stuff in muPDF. I could still mess with it by self-packing CHM (HTML4 has optional tags for ergonomics too), but that sounds very boring.

[+] criddell|4 years ago|reply
> The future of all software is as a web app. Why not bring the spirit of SumatraPDF to the web?

That feels like a 180 after reading a couple thousand words extolling the virtues of small, fast code with minimal dependencies.

[+] burself|4 years ago|reply
I think "spirit of SumatraPDF" means that he wouldn't npm install 800K lines of code into his project 5 minutes after creating it.

I look at the speed and efficiency of VSCode and it gives me hope that it's possible to write the high quality programs that we're used to from C/C++ using web technologies. It's just that right now we don't have enough good programmers creating good programs to incentivize the others to do better.

[+] xwolfi|4 years ago|reply
But he doesn't care about your opinion. As you can see he's not a great team player :D
[+] TonyTrapp|4 years ago|reply
SumatraPDF is my absolutely favourite PDF reader, but I wish the author took security more seriously. At least for a long while there were no official releases for months, if not years, with known crashes in muPDF (for which I think known exploits and patches existed), but since SumatraPDF used a custom muPDF version, it required manual patching. Maybe things are better these days (I see updates are more frequent again), but with PDFs being a big attack vectors these days, it leaves a bit of a sour aftertaste.
[+] mcguire|4 years ago|reply
Here is a lesson you don't often see, but has worked every time I've used it:

"I was able to incrementally convert program form using Poppler API to using Poppler via engine abstraction to using mupdf via Engine abstraction."

Make major changes incrementally.

[+] tanto|4 years ago|reply
When I open PDFs I often want to edit the filename to adjust it to the content. SumatraPDF is awesome and opposed to Adobe Reader and other PDF readers it does not take an exclusive lock on the PDF file so you can edit its filename. The fact that it is extremely fast is another big benefit.
[+] Semaphor|4 years ago|reply
I sometimes work with Paged Media CSS, I’ll often need to generate a file multiple times after editing the CSS to see if it accomplished what I wanted. With Sumatra PDF it instantly updates the file when the new version is generated, it’s awesome.
[+] Macha|4 years ago|reply
Sumatra is pretty nice, and definitely an app I miss on Linux. I used to use evince, but it had more compatibility issues (it uses the Poppler library that Sumatra dropped) and I wasn't a fan of the UI redesigns for Gnome 3.

These days I actually use Firefox as my Linux PDF reader.

[+] jenkstom|4 years ago|reply
So is that Kowalczyk's Law of Software Design? "Small or fast, pick both."
[+] supz_k|4 years ago|reply
One of the pains of moving from windows to a Mac was not having Sumatra. I've been using it on Windows for so long. I have tried many options on Mac, but they just doesn't feel "right" (too many options in viewers like Acrobat, too less features compared to Sumatra in others). Any plans to create a mac version?
[+] calvin_|4 years ago|reply
I'm perfectly happy with Preview.app; I'm curious what's not working for you?
[+] michaelhoffman|4 years ago|reply
I love SumatraPDF. I use Acrobat Reader for most stuff, but while working on TeX documents SumatraPDF is invaluable because it:

- is fast AF

- supports SyncTeX

- doesn't unnecessarily lock the files it has open

[+] whoknowswhat11|4 years ago|reply
Sumatra 7mb Adobe Acrobat DC 2.4gb
[+] willis936|4 years ago|reply
In fairness, acrobat is a full fledged editor of a hacked file format. My Acrobat Reader DC install is sitting st 384 MB and Sumatra is at 18.7 MB; only a factor of 20 larger. :)
[+] zamadatix|4 years ago|reply
Not that it justifies 2.4 GB but the products are very different. One is read only while the other is everything you could ever imagine wanting to do with a PDF. e.g. Infranview is expected to be significantly smaller than GIMP too.

For the most part that's perfect though. 99% of the time I just want to read a PDF so I just use the PDF reading tool not the PDF everything tool. That being said signing/form filling does bring me back to other solutions occasionally.

[+] BugWatch|4 years ago|reply
From what I can see, he's a great team player.
[+] rajandatta|4 years ago|reply
Just want to come to give props to Sumatra PDF. Lovely product - lightweight, fast, portable. Mau not have every feature (not saying it does or doesn't - does what I need) but does a lot really well. Highly recommended.
[+] willis936|4 years ago|reply
I just downloaded it and I'm quite impressed with the ease of use of the color options. Just a few lines in a text file. I can swap between dark and light modes easily.

Does anyone know if the window background can be darkened at all? The window UI text color is controlled by the same setting as the pdf text color, so when using a dark background/light text mode the window UI text is very low contrast.

[+] evanbubniak|4 years ago|reply
> I just downloaded it and I'm quite impressed with the ease of use of the color options. Just a few lines in a text file. I can swap between dark and light modes easily.

Not just that, but you can change the settings file while the reader is open and it will update immediately. I use a one-line cmd script to switch quickly between light and dark.

[+] majkinetor|4 years ago|reply
So far I used colibre's e-book viewer but after this blog post I am hooked :)

I like people that know to say NO and produce obviously good thing on their own.

[+] edwinyzh|4 years ago|reply
I LOVE SumatraPDF because is very fast! In the past I've used Adobe (so sluggish), Foxit reader (was fast).