357 points · by bobsingor · 1y ago · 95 comments
Already working:
- Annotations (highlight, sticky notes, free text, ink)
- True redaction (content actually removed)
- Search, text selection, zoom, rotation
- Runs fully in the browser, no server needed
- Drop-in SDK for React, Vue, Preact, vanilla JS
Why? Acrobat is heavy, closed, and pricey. I wanted something lightweight, hackable, and embeddable anywhere.
Demo: https://app.embedpdf.com/ Website: https://www.embedpdf.com/ GitHub: https://github.com/embedpdf/embed-pdf-viewer
Feedback, bug reports, and feature requests welcome!
https://github.com/mozilla/pdf.js
Not criticizing because there's lots of reason to build things that exist, just curious.
- Is it written from scratch? - Did you have prior experience with PDF format and rendering?
Stupid question: Do you feel LLMs can do that kind of work beyond typical SPAs with forms and CRUD?
I know teams that integrated Apryse, and the costs just to support basic PDF editing are eye-watering.
1: it's like the million monkeys with a million typewriters decided to go work at Adobe and they really have heard great things about mixed text and binary file formats because they are outstanding RCE and stack smashing opportunities
On the other hand, PDF.js has been around for more than a decade. As it is a core component of Firefox, and viewing PDFs is an important part of name business applications, you'd think they'd have not nearly so many issues.
I know PostScript and PDFs are a nightmare, but no small part of me feels like this is yet another case of Mozilla underfunding development.
> they catch more edge case bugs like "Hebrew is rendered backwards" and so on.
I love when my core use case, show stopping bug is considered an edge case. ))In any case, there are more native speakers of right-to-left languages then there are native English speakers.
(I don't take from your work btw, just that it's not a new PDF parser written from scratch or anything.)
So I built my own PDF viewer, this time using pdfium in C++ with Metal for rendering — here’s a quick demo: https://youtu.be/jJMhVn5yzEI
I implemented a tiling technique to balance memory usage and performance. I didn’t realize pdfium could be so performant in WebAssembly — and honestly, I actually prefer developing UI on the web compared to C++.
My code runs natively, so users need to download a client and I have to code the rest of the ui in cpp, that’s the downside. I did consider a hybrid approach with Electron or Tauri, but dropped the idea to avoid IPC overhead and get the best possible performance.
While I'm here, a suggestion to add Undo/Redo; yes HN, I know I could make a PR..
Uncaught ReferenceError: TouchEvent is not defined
https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#...* Links don’t work
* Bookmarks show up but don’t work either
* Text selection doesn’t work in FF
* Middle-clicking (to scroll) in Chrome triggers text selection
* Very slow rendering, when I scroll in pdf.js, everything looks fine. When I scroll in this, everything looks low quality and blurry for ~500-1000ms. Worse for jumping multiple pages at once, e.g. using "end", I get a white page instead of a low quality page.
* Up/Down, Page Up/Down, Home/End don’t work in FF (left/right does work)
It seems to work with Chromium on the same machine.
Little note: when you switch from redaction to view with the redaction tool (red lines) active it stays active in the view mode. Impossible to scroll because it still redacts.
Refresh fixes it.
https://www.embedpdf.com/docs/react/getting-started
I would suggest that you start with a more simple example. like:
<EmbedPDF url={https://snippet.embedpdf.com/ebook.pdf}/>
It would just take one additional component in your NPM package which contains all the more "internal" stuff. Just put the advanced example you have now in one component.
The example with the engine etcetera looks more like an advanced example.
It gets a developer to a quick result in their own app. If they want to go further they can nothing changes there.
A sidenote: That same though might be something with your NPM import - just one would be a better dev experience to start while I understand why you offer them separately for more advanced.
I’m not a JavaScript developer (perhaps there are cultural differences at play?), but in general I think it would be polite to credit the developers of the actual PDF engine.
Beyond that, powered by... and similar make sense if the library/engine allows or encourages the behavior.
I would also mention it in the README.md.
But I assumed it was also a standalone app? Could this be used as a standalone app in some fashion?
If you want a demanding user with diverse use cases to test on diverse devices, you are invited to contact me. My Gmail username is the same as my HN username.
Probably the number one missing feature of PDF editors/viewers. Miss it everytime someone sends me a PDF without outline.
I wish I was still working at Apple and had my suite of nasty PDF's to test with. Some were just huge files (like a catalog for McMaster-Carr or wherever), another (a version of The Bible?) had an odd text layout across the columns on each page (for testing text selection), maybe one file was a huge single-page PDF street-map of a city (with lots and lots of rendering code and arbitrary text runs all across the map, etc.).
But that's a bravery to deal with the brain damaged PDF file format.
Would be wonderful to have PKCS#11 and PKCS#12.
It needs a web browser so no alternative to Adobe PDF viewer.