MuPDF WASM Viewer Demo
mupdf.com
mupdf.com
Mutools is fantastic for PDF I use it as a backup converter when imagemagick fails in my document viewer: https://github.com/dosyago/chai
MuPDF is my main PDF viewer, due to its unmatched performance and good full-screen UX, even if I sometimes encounter PDF files that cannot be rendered by MuPDF, when I have to fall back to other viewers, e.g. Okular.
And loading times are quite bad (10 times slower - compared to firefox or chrome pdf viewers).
Which is what I guess you mean about 10x slower -- so you're making an unfair comparison as you're counting the network at peak, whereas browser plugins load from disk or memory.
But I actually thought the load of the PDF (once the app was loaded) was, for MuPDF.js, slightly faster than the browser plugin. When I watched it, tho I have not benched it. Do you have any benchmarks?
As others in the thread also report significant speed gains I think you either have some weird issue with your setup or how you measure performance.
Checked Sumatrapdf on Windows and it's better - while on some fast mouse wheel scrolling the web version is more responsive, but then it doesn't adjust text quality, so shows blurry version (though zooming seems to fix it) while the local versionalways shows high quality text (sometimes after a delay)
Pageup/down scroll is without a delay locally but it scrolls through blank pages, so I guess mouse scroll just always does quality rendering, thus it's the only operation that's slower locally
So while pages load faster in the web version, they are of much worse quality initially
[1] https://github.com/dosyago/chai/blob/a6b7fb50647ae001185bdc8...
[2] https://github.com/dosyago/chai/blob/a6b7fb50647ae001185bdc8...
[3] https://github.com/dosyago/chai/commit/45da5f12ab8a817dc4f74...
[4] https://github.com/ArtifexSoftware/mupdf/blob/master/COPYING
As an aside — would be interesting to get Artifex's comment on this — but I'm not even sure it applies as we install the mutool binary via apt, call it from bash, and we don't modify or use their libraries at all. Would this even need to comply with AGPL at all? I don't know.
If you'd carried on your search of our source a little bit further, you'd see we use the mutool binary: https://github.com/dosyago/chai/blob/37c1a1ec0941d81e0d6f8af... ; and you also may have discovered what the AGPL means: https://artifex.com/licensing/agpl/ Hahahaha! :)
Another commenter has dealt with that:
https://news.ycombinator.com/item?id=40105915
This usage is considered "at arms length".
If you're interested in chai, I encourage you to check out a way it's being used for real in this live demo of BrowserBox / CloudTabs: https://browse.cloudtabs.net/signupless_sessions
Search for a docx, PDF file whatever and you can convert to images without ever downloading to your device. We've got 6000+ users in 17 days on our Puter Browser app: https://puter.com/app/cloudtabs-browserbox
We have a lot of exciting things coming soon, too. :)
Appreciate you droppin by with your dose of clarity! Hahaha :)
Actually I think I do know: there are a couple of competitors to BrowserBox operating around the world, one based in Europe, one in the Americas, that all use a similar WebRTC video streaming method out of containerized headful Chrome with getUserMedia extensions.
Our method is different, but lower resource usage, and more customizable. Theirs requires GPUs and has higher base costs. But that's not the thing they're mad about: it's actually much more inflexible because they are not instrumenting headless Chrome, they are just streaming the viewport of headful using xvfb.
They can't 'downgrade' off GPUs because their whole video codec depends on it, and they don't / can't control if the browser is paused via an alert modal, doing a basic auth prompt, downloading a file. Even multiple tabs are a major challenge for that method, and mobile form factors? Basically a non-starter.
These competitors resent our flexibility and are jealous of our larger control of the browser that enables us to more easily deliver all these things. They're concerned that implementing the same will run them afoul of our codebase, and they actually hoped to use/test/deploy BrowserBox when it was open-source, but became furious when we made it require a paid license for commercial use.
Consequently, they've been acting shady across a range of threads, trying to "not compete" with us by using concern trolling in an attempt to tarnish our reputation. Shadily and dodgily not competing but being abusive and dishonest!
The sad thing is: I like their products! I respect their technical accomplishments and admit they have better quality video streaming! At least right now -- but we never optimized for that.
The issue is we can "snap in" a video codec layer whenever we please, if we want. They have 'run the experiment' and proved it is indeed possible to achieve real-time interactive streaming at relatively low latency, albeit higher fixed resource cost. This is appropriate for some applications!
It's just that the method they chose has less control and customizability, and they cannot "downgrade" out of their rigid set up because they have no alternative. They were lured by the promise of higher quality streaming into a more inflexible architecture, while we pursued the "low end" of virtual browsers for automation which ended up giving us abundant control, and low latency streaming that's more flexible overall, not just across devices, but on low resource situations, while also performing very well at the high end.
They have really ramped up their shady tactics since we launched CloudTabs and integrated with Puter. CloudTabs is our BrowserBox demo Saas, that was just meant to be a big funnel for licensees but ended up growing independently. Since launching 18 days ago we already have 6500+ users, just through Puter. We have a bunch more going straight to CloudTabs. It's crazy. Nothing can stop this train! Not even the lies of phoney 'competitors' acting shadily from the corners instead of actually competing with integrity! Hahaha!!! :)
Also it's quite slow to load the WASM, about five seconds before it starts processing the PDF.
This is on a fairly recent mid-range Samsung phone (Galaxy A52s 5G).
Edit: turns out it's View -> Outline to remove the contents pane. There's no "fit to page" option so I still couldn't see the whole page - the 50% zoom out option wasn't sufficient to see everything corner to corner.
When the Touchpad was firesaled, I got one and was disappointed with the PDF viewer. Because there was no such thing as WASM (or even asm.js) at the time, it used out of the box a service provided by Adobe that on request from the UI rendered tiles of the PDF at different resolutions, depending on the zoom level.
Since the frontend code was JS, it was easy to implement an alternative via mupdf (https://github.com/filmor/webos-pdf/blob/master/arxservice.c...). Via the same inefficient process (rendering png tiles onto the filesystem), the mupdf implementation was about 3 times faster than the original (though, it's been 13 years, the actual speedup might have been less :)).
And if your browser has proprietary/not “generally available” compiled/minified code loaded, from Widevine to your corporate Chrome extension, are you in violation of AGPL if you don’t share all the sources to all those things, which by law you cannot have?
Not a lawyer, but the idea of AGPL WASM blobs gives me shivers.
No. Clearly not. A browser making connections to servers is not the same as a "user interacting with it remotely".
> And if your browser has proprietary/not “generally available” compiled/minified code loaded, from Widevine to your corporate Chrome extension, are you in violation of AGPL if you don’t share all the sources to all those things, which by law you cannot have?
Only if you distributed the browser with AGPL code in it. If just runs WASM code its no different from any interpreter running GPL code.
The source to your changes to the binary, you mean, maybe? I don't understand the question. You seem to be implying that using an AGPL WASM binary would require you to share the browser's source. If that binary were a network application that was serving other clients, it makes sense to me that you'd be required to share modifications that you made to that binary, but I have no idea of how you would include the entire browser in that calculation.
If there's anything scary, I'd say it would be that if you were serving a WASM blob to someone's browser, you'd have to be prepared to also distribute the source (and changes) to the binary if it was AGPL licensed.
Of course NaCl is no longer available to web clients, so I don't know what the exact state of the Chromium PDF viewer is. Is NaCl maintained just for it or is it using some other sandbox now?
(But it could be built with the Emscripten flag to translate the wasm to JS, which would work, but would be slower.)
But I wonder if there are any intrinsic issues with displaying EPUBs using WASM?
It's still useful since browsers don't come with built-in EPUB support.
most epubs are just zipped html, but not all.
There are different versions to this file format and some need to be parsed as xml. The chapter files will mostly adhere to html with caveats wrt anchor tags, image sources and similar as well as metadata wont be parsed/work with html parsers.
You could even - technically - take a picture as an input and then render it via background color rgb() using divs pixel-by-pixel. thatd still fall under that description.
Whoever I spoke to at Artifex [0] several years ago told me the terms of the commercial license were that if any output of muPDF were visible to the public, my company would owe $10k/mo plus some share of the revenue of the company. Unlimited internal use fell under the AGPL and was therefore free.
Btw, the software is incredible, it was a shame I couldn't use it!
While I'm quite FOSS positive, a lot around GPL style licensing hasn't been tested in court and I don't want to be a pioneer in this area. Besides the business aspects of having to maybe publish some of the 'secret sauce', of course.
CompileError: at offset 0: failed to match magic number