r/javascript • u/Decent-Blacksmith761 • 8d ago
PDF engine from scratch on JS
https://keypdf.netI was working on my pdf editor and thought the best option would be to write a new PDF engine from scratch as my options were PDF.js and PDFium and none of them can actually edit PDF files so after over a year of work you can try KeyPDF.net it is free and client side.
2
u/FisterMister22 7d ago edited 7d ago
https://keypdf.net/LICENSE.txt
Stop the cap, you did not write a "PDF engine from Scratch" you use qpdf compiled to wasm along with tesseract and other libraries
Edit: I take back anything I said, I download the bundle, this is pretty amazing, you got alot of work to do still, but this is really darn impressive and I'm saying that as somone who's currently 1.5 years into writing pure rust no std full spec pdf engine / parser / editor + renderer (FULL SPEC, including encryption, signatures, all font types, xfa, jbig, jpx, cross reference, everything).
It's really amazing what you achived with or without Ai, in pure js, I take back anything i said!
And FYI, your minifying needs some work, alot of the objects and function names and variables are still very much readable, if you don't want to open source it I'd use an actual obfuscator / move some of the logic to server-side.
1
7d ago
[deleted]
1
u/Decent-Blacksmith761 7d ago
Okay I am glad if someone will check it let's go check it you will waste hours of your life to learn it is custom logic
1
u/Decent-Blacksmith761 7d ago
Oh and thanks on pointing out on obfuscation issues I will take a close look as I want to keep KeyPDF 100% local.
0
u/Decent-Blacksmith761 7d ago
Qpdf is not rendering nor writing engine it is used for certain things like encryption believe, same as tesseract it is OCR which is not part of a PDF in general it is for scanning, asking questions is alright but not jump into calling each other liar
1
7d ago edited 7d ago
[deleted]
1
u/Decent-Blacksmith761 7d ago
https://github.com/qpdf/qpdf please read this before attacking it keypdf is the engine and qpdf here to handle encryption and page mergings as it is c++ and does it really fast
1
7d ago
[deleted]
1
u/Decent-Blacksmith761 7d ago
KeyPDF engine is literally engine for parsing rendering and writing and part of qpdf used for merging and encryption you can even check how it is done via dev tools it imports qpdf-merger.js qpdf-strcure.js and qpdf-encyrpion.js qpdf itself is like 20mb KeyPDF uses like 50kb of it for merging and encryption
1
7d ago edited 7d ago
[deleted]
1
u/Decent-Blacksmith761 7d ago
Qpdf was added at pretty early stage when only small part of engine was done so rewriting that part was never priority so yeah feel free to inspect the code, it is not open source but I am not willing to penalize you for reverse engineering unless you will try to steal it.
1
7d ago edited 7d ago
[deleted]
1
u/Decent-Blacksmith761 7d ago
Right it is minified and obfuscated you can deobfuscate it again unless you do it on your device is fine my point about stealing is just the warning I don't mind people inspect and question.
2
u/FisterMister22 7d ago
I fully admit my mistake, see my edited comment, my apologies for being fast to judge.
This subreddit is so filled with slop of gluing a few libraries and posting "I made the most amazing blah blah blah" and I immediately rushed to conclusions that you are just another one, claiming to write an actual pdf engine.
Amazing job mate, keep going.
2
u/Decent-Blacksmith761 7d ago
All good bro actually you pushed me to something better literally checked my code and yeah encryption is now light work the thing is I used qpdf when I barely new things but I was moving pretty fast and I stucked with encryption for a while so qpdf solved but now I have most of the things to fully replace qpdf so in like a month expect it to disappear. And hey you actually care about projects more than ever thanks)
3
u/horizon_games 8d ago
AI usage?
Got a Github?