Lessons learned from 15 years of SumatraPDF, an open source Windows app (2021)
blog.kowalczyk.info
blog.kowalczyk.info
If you haven't already: use Ctrl + K (Command Palette), a better way to operate the program than menus etc.
Also I'll plug my latest project: I "ported" notepad2 to web:
https://onlinetool.io/notepad2/
It's 85% done i.e. some functions are not implemented.
On Chrome / Edge it can even read / write files from your computer (needs File System API). Otherwise files are stored in the browser in IndexedDB.
Not sure if it makes sense but here it is.
It's small because it's Windows only, and very likely avoid cross platform libs and rewrite everything on their own. For writing personal project, I agree cross platform my be over-rated. Just stick to your favorite platform. Make it works and optimized.
I use zathura on Linux nowadays, and it like a not-too-distant cousin. It's perhaphs a bit less newbie-friendly, but it shares the same focus on "let's just render things fast and no BS", and also uses mupdf under the hood.
As for SumatraPDF, I haven't used it myself because I don't use Windows as my main OS, but I definitely remember seeing that icon on other people's Windows machines. So it is reasonably popular in my part of the world. It also blows my mind that Windows still doesn't come with a proper built-in PDF viewer like macOS does.
Thank you for doing what you're doing! People like you make the world a better place.
Usually that viewer is the browser, so by default Edge is the default PDF viewer.
The browsers are also "an endless festival of security bugs." Especially since they started to execute remote code. I can't view pdfs in browser. I need to zoom, find, and copy parts of (electronical schematics) pdfs and the browser version just sucks.
I imagine they've steered clear of stepping on Adobe's toes since then.
The PDF functionality in Edge avoids these problems, as it's a standard web browser feature these days.
> Do your open source projects help with getting new gigs?
I think it did a bit but not as much as I think it should.
You would think seeing a proof someone can deliver a complex app by themselves would be enough to skip the coding part of the interview, but then you would be wrong.
Thanks for all of you work.
I tried PDF.js, and it worked, but we ended up picking the very worst and most insecure PDF viewer that exists. Guess who that is?
Great software by the way, I was blown away by the speed of loading a pdf file. I never had such a fast PDF reader up until I started using Sumatra since last year.
But agreed, many forget certain programs/tools/etc don't need to be actively to be updated once they just "work". Unless it's been rewritten in Rust, or if it's slightly older Go ;-).
I hate to admit this, but I feel the same way when it comes to programmers themselves.
I've tried very, very hard to be mindful of this in an effort to correct it, but I still have this gut feeling when I encounter a fellow programmer with the general put-together-ness of someone in the C-suite.
What makes it worse is that I've had this gut feeling validated several times in the past. I once worked with a very cover-of-GQ programmer who, after ten+ years in the industry, would struggle with FizzBuzz-esque problems.
Nor a sysadmin that isn't wearing black, running Linux and/or listening to metal. Unless they have a white beard, then you know they have been around for a while.
(Just partially serious here, don't read too much into it. But you know it's true.)
So please, please don't judge a book by it's cover. Actions speak louder.
Suits don't set off my bullshit detector. Legitimate hackers have had to wear them since the dawn of computing.
The devil is in the details. Alarm bells start to ring for me when the sum of the details exceeds what my gut feels is reasonable.
Being worthy of the cover of GQ takes a ton of time, energy, and resources to maintain.
Managing to maintain the same perfect tan all year is an investment for sure, but not necessarily an investment that aligns with the hacker ethos.
Was it a tailored suit by a designer brand? Alternatively, was it a fancy bespoke suit?
Suits usually don't set off my bullshit detector. Many legitimate hackers have had to wear them since the dawn of computing.
It's the details that catch my eye.
The money, priorities, and (most import of all!) time are in the details.
After getting burned by that a few times, I learned that the only way to deal with it was to ensure that those who run a project will be able to justify putting time into it when the actual realities and responsibilities of life like career, family, children etc start raining down.
Its all fun and games when you are in college or fresh out of college and maintaining an open source project. But the time and effort put into it suddenly becomes difficult to justify when you have more responsibilities at work, or even further, a family to which you have to justify spending that time on that project.
Now, the assumption of open source community is that, when that happens, someone else will take over the project and it will just keep going on.
Except it rarely happens except for very large projects. The net is filled with abandoned projects. And even when someone takes over the project, there is no guarantee that the original vision and quality will be kept.
So its much better to make sure that every open source project has a way to fund itself and its developers by making money in some way.
Probably, all of their best programmers are working on revenue generators, not performance.
At my $DAYJOB you could fire 80% of the R&D staff and refocus efforts onto what our users actually want, and we would probably have a better product which less major incidents. This is for a company only in the ~$100m revenue. Of course, we're not $WEBSCALE so maybe things are different for the $1bn+ revenue companies.
These execs don't use Acrobat themselves.
That is the failure of market optimization nobody wants to talk about.
It's an undeniable fact that competitive pressure and desire to make money incentivize people to solve other people's problems, leading to products that get cheaper and better-aligned to customers' needs over time. A fact that's often brought up in defense of free markets and entrepreneurship. What is however ignored or left unsaid is that, it's true up to a point.
The same feedback system that initially aligns producers and consumers doesn't have a stop condition for "the most value for customers". There is no local minimum there either. That's because the market process is not actually optimizing for providing value in the first place. It happily blows past the point of being optimal to the customer, and continues to optimize for profitability by making things worse and worse for the consumers, until the end result is just "worst possible thing that's still marginally fit for purpose".
I suppose in a perfect theoretical world - the one inhabited by frictionless spherical vacuums in a cow - this wouldn't be the case; market competition would allow people valuing quality to pay for it, and get quality things. The real world, unfortunately, is full of friction, and full of limits.
An example phenomenon, that seems to commonly occur in all kinds of product categories, is the self-segregation of vendors into two groups: the cheap vendors, and the premium vendors. Every vendor serving the "middle" - selling high quality products for a reasonable price - has two obvious ways to improve their margins: move "down" a little bit, by cutting on quality to lower their costs and pocket the difference, or go "up" a little, by improving quality further and increasing the price even more, again pocketing the difference. Here's what happens when each vendors makes such step, either "up" or "down":
- Some customers prefer to take the step "down", some others are happy to go "up", but this isn't symmetrical - at any point, a subset of customers is hitting its spending limits, in the sense of marginal price increase not being worth the marginal quality improvement. Those customers will migrate "down".
- Customers preferentially migrating "down" means the slightly lower quality product gets cheaper (economies of scale), while the vendors of the slightly higher quality product need to raise prices even more, to compensate.
- Profits of each of the vendors improve - both of those going "up" and "down" - but then, competitors follow and the extra margin evaporates.
- As a result, companies end up being somewhat locked in their choice - trying to reverse it will only risk getting outcompeted.
Now, iterate that several times, and you can see how the market starts splitting into two clusters. Unfortunately, because the market size (number of likely customers) is limited, trying to keep serving the "middle" only means you watch your customer base evaporate. Eventually, the profits available in the middle are not enough to recoup fixed costs, at which point the whole quality class itself evaporates. Without it, new customers have no choice - it's either the shitty version or the overpriced version, because the good deal is no longer on the market.
Note that there are no monopolies in sight in this scenario - all it takes is to have a finite population and fixed costs, and over time, the market will segregate into a cluster of maximally shitty versions of a product, and a cluster of exclusive (or certified/supported industrial use versions) but expensive versions of it.
- Small and fast
- Hand-crafted for a particular platform
- Not bloated with oddly specific UI menus and configuration settings
It has one job and it does it very well. Thank you for it.
I mean, my employer paid 500 euros for an Iphone which maybe costs 50 euros to be produced. From those 450 euros is an Apple engineer not able to test the smalest phone with bigger fonts and to implement proper hyphenation on menu items ?
Yes, there are custom settings you can set, but for simple software, I just want a simple switch.
On AMOLED displays, that #000000 not only looks nice, it also saves battery, as it shuts the given pixel off. The difference is substantial - with modern UI trends that waste most of screen space, a "grey on pure black" color scheme can often keep more than 50% of the pixels off! Meanwhile, a typical "grey on grey" dark mode will keep 100% of them on.
The power consumption on pure black vs another dark color is extremely similar. This is because on AMOLED screens individual pixels control themselves and power for off vs dark is very similar.
Source: https://www.xda-developers.com/amoled-black-vs-gray-dark-mod...
Also, gray uniformity is an unfortunate shortcoming on a lot of OLEDs.
Straight hex codes of course work, but they're not a good option if the program has more than one color.
Yep. On Windows there's:
- IrfanView for image editing
- foobar2000 for mp3s
They've been on my "must have" install list for ~20 years.There's also Ditto for managing multiple clipboard entries. It's a good example of how a small open source tool with an optimized UI for 1 thing ends up being 100x better than the same feature MS tried to implement straight into Windows.
- Configure hot keys to bring up the clipboard selector (I use CTRL + Alt + V)
- Quickly select a clipboard item via hot key, arrow keys or mouse
- Search through the list of clipboard items immediately
- Configure how many items get saved and when they expire
- Ability to paste in plain-text as a separate hot key
Ditto hits all of those marks. Overall it feels like it was built by a person who actively uses it.It most likely takes about 5 lines of code to implement but what's important that the author actually thought about and took care about this scenario.
There is also a plugin to reformat JSON.
It was the perfect program: completely invisible and yet completely functional.
FOSS in particular tends to lean into the Customizability aspect far too much; I'm a big fan of it, but it took (for example) GIMP years to actually shift it's interface to being single-window by default and making it less easy to close the default side-panels (which unless you knew how those were put together were also basically impossible to get back, so the thing most people did was either stop using GIMP or wipe their installation, hoping that a reinstall would restore the windows).
A lot of that comes down to the rather... weird relationship FOSS has with depreciation; most projects will gladly break people's workflows because "it's just better to do it that way" and at the same time, you have some obscure workflow nobody but the dev who wrote it still relies on, so you can't update a default that should have been changed 3 years ago because then they start complaining (and usually gets to keep the defaults fucked because of project seniority, which in my experience tends to matter far more than anything else in FOSS projects).
There's a balance to keeping things simple with the advanced tools needing to be deliberately sought out. SumatraPDF in my experience manages to walk that balance very well. It's the kind of software where just using it feels intuitive; I've been able to let elderly people install it and use it without needing to spend hours educating them on how it works. It just shows documents and the basic icons make immediate sense.
(On the other extreme end, proprietary software can come across as almost completely nannying nowadays to the point where I stop using it because I feel like I'm getting lectured like I'm a 5 year old. Again, there should be a balance.)
I've always thought this is exactly how headers should be treated. Effectively they should be interfaces importing functionality locally, and each header should make it explicit what is imported from name alone.
0, https://github.com/sylikc/jpegview
ShareX is the nr1 software I wish was available under Linux. It does so much and perfectly. But I guess the whole X11/Wayland + different UI toolkits makes it complicated.
And honourable mention: voidtools Everything. It's freeware, not open-source, but it's the best search utility for Windows around. It beats the Windows Explorer / startmenu built-in search on every single axis, to a comical degree.
I can vouch for heaptrack[1] nowadays, although it's pretty much Linux only. It's under the umbrella of KDE, but a heaptrack trace only requires a CLI app, and there is a nice Qt viewer to analyse the memory consumption.
It tracks the memory utilization at the level of malloc'd/free'd bytes. It's fine if your memory leak or other memory utilization problem is on this level. Recently I dealt with an issue, where increasing memory utilization was caused by fragmentation within the allocator. This didn't show up in heaptrack as an increasing memory utilization, but heaptrack still pointed out where most of the temporary allocations happened, leading to the culprit of the fragmentation.
Yes, yes, yes. I wasted far too much of my life building things that nobody actually cared about because some executives spent far too long in conference rooms huffing each other's farts and creating product plans that were bigger fantasies than anything Tolkein ever wrote.
And I'm not even mad about the bullshit, really. By all means create the fantasy-filled documents if that's what it takes to get funding/approval. The part that kills me is when people start believing their own bullshit. Dream big but work small. And then ship! Close those feedback loops.
Discussed at the time (133 comments): https://news.ycombinator.com/item?id=27968900
SumatraPDF 3.4 Released - https://news.ycombinator.com/item?id=31566401 - May 2022 (79 comments)
Lessons learned from 15 years of SumatraPDF, an open source Windows app - https://news.ycombinator.com/item?id=27968900 - July 2021 (133 comments)
Lessons learned from 15 years of SumatraPDF, an open source Windows app - https://news.ycombinator.com/item?id=27963298 - July 2021 (4 comments)
Sumatra PDF Is a PDF, ePub, MOBI, CHM, XPS, DjVu, CBZ, CBR Reader for Windows - https://news.ycombinator.com/item?id=27589337 - June 2021 (2 comments)
Did he share that with rest of the company or kept the knowledge to himself ?
> In our retail business, we know that customers want low prices, and I know that's going to be true 10 years from now. They want fast delivery; they want vast selection.[1]
[1]https://www.goodreads.com/quotes/966699-i-very-frequently-ge...
When I have the PDF open with Adobe Acrobat, my LaTeX compiler can't write over the open PDF file.
Of course, it's blocked at work so I can't use it on my Windows machine.
It hints at what I think is a natural cycle of software. Software evolves with its user base, its existence and modification over time proving its value. Then, there comes a time where the weight of its history (and feature set) becomes too much of a burden to its current user base. At that point, something happens to shed the weight.
If there’s one feature I’d absolutely love, because it’d let me delete Acrobat Reader again, it’d be digital signatures. Clients demanding that documents be digitally signed (but self-issued certs were ok?!) was the only reason I grudgingly reinstated it on one of my machines.
Make a PDF library cross platform? Perfect sense. Make a PDF reader cross platform? You'll end up with a mess.
The reader itself is mostly the UI an interacts with the OS's API for rendering and drawing. There's really no way to write one that works on different OSs unless you either have three separate codebases. Or you can hide three separate codebases under some abstraction that makes the application look alien on all supported platforms.
Basically every app should be like this.
https://github.com/artiebits/pdf-to-printer/blob/master/src/...
I don't know if anyone remembers this but Exchange ActiveSync debuted around 2003
Blackberry had their own standalone solution that was a whole slew of Windows services and service accounts integrated with your Exchange server.
This, this is why I love the app. Adobe Acrobat has more pleasing GUI but it clutters with buttons and sidebars and functionalities that I'll never use most of the time but they consume most of the screen real estate. When reading, I'd like everything to get out of the way and let me focus on the content, SumatraPDF serves me well.
When the allocator is statically instantiated, it adds itself to a global list.
Periodically (and at shutdown) log the top N heavy hitter allocations. In testing, assert there are no outstanding allocations in a static destructor.
The overhead of this is a couple of increments / decrements per allocation / free, so you can probably leave it on in production builds.
I have a powershell script that downloads PDF's from a URL, and prints them to a specified printer, I'm using Foxit right now, however there have been substantive changes to foxit, and I'm worried about the free option going away.
I'll for sure check this out.
Ah, the C/C++ modularity story is such a monstrosity... but modules are coming, and the build times are drastically decreased.
So, how you are going to write cross platform apps, then? :D
This is very hard to do in practice for any big enough software, but then using Qt, Java or C# frameworks is probably worth it since their impact will start to be small compared to your application footprint.
I admire and respect you for that. Thank you really for building SumatraPDF.
Does it have allow searching by folder yet? It’s the killer feature that I need in Acrobat