4 ms·
PDFJS is fantastic. But PDFJS folks, how can you do such a subpar job at documentation? There is really no documentation available on pdfjs. Or a proper chang
by emilsedgh 5y ago
PDFJS is fantastic.
But PDFJS folks, how can you do such a subpar job at documentation?
There is really no documentation available on pdfjs. Or a proper changelog. Like in this article they talk about JS execution in pdfjs. And how they have a solution called quickjs. _no_ documentation whatsoever about how to use it.
This has been their documentation for years:
https://mozilla.github.io/pdf.js/api/ https://mozilla.github.io/pdf.js/api/
Had I created something as complex and magnificent as pdfjs I would've documented _the hell_ out of it.
I get that pdfjs usage in normal web is not their priority and what they care about is the Firefox pdf viewer but I'm sure they would've had a much better contribution rate had they done better api docs.
- saagarjha 5y agoYeah, it’s a strange choice considering they ask people to not use their viewer unmodified…
- gervwyk 5y agoShameless plug. I recently wrote an article for Lowdefy (co-founder here) for using pdfMake with Lowdefy to generate pdfs. Works really great and easy, perhaps the next step is to add a pdf render block using pdfJs. See the article: https://docs.lowdefy.com/generate-pdf-document-from-data https://docs.lowdefy.com/generate-pdf-document-from-data (edit: confused pdfJs for jsPdf)
- gervwyk 5y agoSorry I confused pdfJs for jsPdf. Perhaps the next step is to build a Lowdefy block that uses pdfJs to render pdfs :)
- rectang 5y agoI recently had to implement a custom PDF viewer using PDF.js. It took a loooong time, because PDF.js is so confusing to work with. We went way over what we thought was a conservative time estimate. :( It's not just a matter of documentation, but API design. Beyond the bare minimum functionality, you'll need bits and pieces of semi-public API. For example, if you want to use the "text layer" (for selectable text) you'll need a CSS file which is inside the `web/` directory. But what's in `web/` is incomplete and not officially supported.
- iapark 5y agoI wish there were better wrappers for it too. One of the projects I'm still quite proud of that I made as a student was a react wrapper around PDF.js used here https://boardbook.kent.edu/ https://boardbook.kent.edu/ (though since they no longer seem to be using it I guess it will probably go dead at some point), but the fact there wasn't really a good open source one and as you say the docs were pretty lacking. My favorite discovery was that the performance was much worse unless I registered a particular scroll listener. It's been years now so I only vaguely remember, but I think registering a listener for `wheel` would cause scroll events to be treated as blocking and this made the whole scrolling experience less janky.
- spankalee 5y agoThis reminds me that I should finish off my <pdf-viewer> event based on PDF.js with the goal of just being able to drop an easily customizable viewer into any page: https://github.com/justinfagnani/pdf-viewer-element https://github.com/justinfagnani/pdf-viewer-element On the docs front, I couldn't agree more. It's tough to use.
- lucideer 5y ago> And how they have a solution called quickjs. _no_ documentation whatsoever about how to use it. This isn't an excuse for the lack of docs for pdfjs itself, but fwiw quickjs is a 3rd-party project that's documented here https://bellard.org/quickjs/quickjs.html https://bellard.org/quickjs/quickjs.html
- gizdan 5y agoA while ago I tried parsing my payslips with PDF.js. It took me way too long to figure out the API calls needed. There were a few examples and that's it.