7 ms·
Show HN: I made a simple PDF text editor
- shashanoid 6y agoHi, I bootstrapped this simple website. Let me know what you think :)
- mhasbini 6y agoI tried it with a bit complex pdf structure and it worked like charm +1. Would love to learn more about the underlying techniques/tech.
- dellinspiron 6y agoIt just calls https://github.com/pdf2htmlEX/pdf2htmlEX https://github.com/pdf2htmlEX/pdf2htmlEX on the server.
- echan00 6y agoWhat calls what?
- chipperyman573 6y agoYou could create a file named ; echo 'hi'; # and it appears as if it would probably run anything you put between ; and # (in this case it will echo hi). Unless the filename is sanitized, which it appears to not be.
- hombre_fatal 6y agohttps://github.com/shashanoid/Simpdf/blob/1557bf838a8debeee1a6f21c12ee3e91c420b855/backend/run.py#L31 https://github.com/shashanoid/Simpdf/blob/1557bf838a8debeee1... Btw, arbitrary code execution vuln here, OP.
- deleted 6y ago[deleted]
- parhamn 6y agoYeah. Switch array & args disable the shell. I hope they’re not running that locally as the download script suggests. But then you still have a bunch of other security issues. Shrug.
- miccah 6y agoI'm investigating the same. The upload endpoint uses secure_filename to get the filename used in that func. I'm not familiar with it, but the docs say it could return an empty string.
- shashanoid 6y agoHey, there's nothing complex going on. I'm using a tool to convert pdf to html, and it does a phenomenal job.
- saradhi 6y agoWhat's up with requirements. That's a lot and I don't see all being used. did you line them for new features?
- koulvi 6y agoI used this to delete a few pages from a pdf file. However, I can't download the edited version. The "save and download" option is just resulting in opening another blank webpage.
- throwawat573635 6y agoYou should provide a sample pdf file so we don't have to hunt around for a (small) pdf file just to see how it works.
- oxbridge 6y agoWorks, it changes the font type after editing
- schoolornot 6y agoA little glitchy with complex PDFs but WOW, amazing work!
- smhmd 6y agoI tried it with a relatively complex pdf and it blew my mind.
- mamurphy 6y agoThe website isn't loading anything for me right now.
- salutonmundo 6y agoI am getting a Cloudflare 522.
- shashanoid 6y agoIt's back up again.
- longtom 6y agoUnfortunate name: https://www.urbandictionary.com/define.php?term=Simp https://www.urbandictionary.com/define.php?term=Simp
- userbinator 6y agoFortunately, I don't think many people will be offended by the name... ...or not as much as The Gimp, at least.
- Fission 6y agoLuckily, there's some decent precedent indicating that this should be okay in the long-run. https://www.urbandictionary.com/define.php?term=Git https://www.urbandictionary.com/define.php?term=Git
- yodaarjun 6y agohackernews traffic crashed the host :( Cant wait to try tho!
- deleted 6y ago[deleted]
- kyawzazaw 6y agoI love it. How do I save it?
- dheera 6y agoNow I just wish there were a version that could run locally. All the Linux PDF viewers suck -- they can't even save a fill-in PDF form or insert a signature.
- jack20 6y agoThe best editor I’ve found is Qoppa PDF Studio. Although not free it is cross-platform (written in Java) and their licenses are perpetual. They do have a free viewer app which can fill interactive forms and this works on Windows, Mac and Linux: Qoppa PDF Studio Viewer.
- mrb 6y agoI spent an afternoon trying a bunch of them some years ago. I settled on the freeware Master PDF Editor version 4 (version 5 inserts a watermark unless you buy a license). https://code-industry.net/masterpdfeditor/ https://code-industry.net/masterpdfeditor/ It is super lightweight and opens any complex PDF. Can insert signatures, can edit anything in the PDF (without changing the font even if the font is embedded in the PDF—as long as all the glyphs you are typing are present in the font), etc. My only complaint is that it won't edit an encrypted PDF, but a one-liner Ghostscript command can remove the encryption automatically: https://gist.github.com/compleatang/6046249 https://gist.github.com/compleatang/6046249
- bmn__ 6y agohttp://enwp.org/Okular http://enwp.org/Okular can. Please don't bait for answers with generalisations.
- BossingAround 6y agoI use xournal for exactly that--filling out a PDF form and inserting my signatures.
- tjbiddle 6y agoGithub is in the footer on the website if you want to run it locally: https://github.com/shashanoid/Simpdf https://github.com/shashanoid/Simpdf
- distances 6y ago
- ray991 6y agoI really wish the PDF layout was easier to parse. No matter which library you use, you always run into edge cases which make text selection and extraction an issue on certain files. I was recently extracting financial data from a bank which provides only PDFs and every time they changed the format just a little bit I had to change large parts of my code to extract the transactions I wanted.
- dmoo 6y agoI’m sure you’ve looked at it but I have a lot of success with pdftotext -layout
- saradhi 6y agoI agree to this, it's the same with insurance companies too when resolving claims. Feels like they certainly want to make the extraction look complicated for an unknown reason. Not often and not all companies but edge cases
- jfk13 6y agoPDF is designed to present a human-readable document, not to serve as a data interchange format.
- gnicholas 6y agoI tried using this with an invoice that I'd created using invoice-generator.com, in the hopes that it would be an easier way to make new invoices. When I tried to replace the To party's name, the text came back partly bold and partly not. There was also a weird overlay on an email address on the bottom that said something about email address protected. Would love to have a tool like this that worked for making new invoices, among other things!
- punnerud 6y agoIn EU it is illegal to edit an invoice outside a program that keep track of all changes, bill number etc. Not the same in US?
- londons_explore 6y agoCitation needed... I don't think laws are ever that prescriptive about what you have to do. As far as I know, the only requirement is when the tax inspector arrives, you need to be able to produce a complete and accurate list of all invoices you have ever sent to customers.
- DanBC 6y agoThey aren't editing an invoice, they're using a template to create a new invoice.
- J_cst 6y agoSource?
- killerpopiller 6y agoat least for Germany: digital invoices shall be processed in a way that manipulation can be ruled out (GoBD). Hence companies use special scanner and document management systems which document the Revisionssicherheit.
- corty 6y agoAnd that is the new, more relaxed situation. At first, digital invoices were required to be signed with a qualified signature, i.e. spend a few hundred quid a year on certificates by a few select CAs (only the usual german "suspects" could qualify due to intentionally onerous requirements).
- michaelmrose 6y agoA few notes. It doesn't seem to work with documents that have multiple columns. Pushing text over just overwrites the other column. It doesn't seem to reflow text where the source document obviously had margins possibly because that information is looooong gone. Hitting enter to move text to the next line didn't move other text it just again seemed to overwrite it.
- x32n23nr 6y agoCongratulations for the launch. Looks nice. For those that are cautious uploading sensitive PDFs, you can always just open them with Inkscape, and start editing pretty much anything in a document. PS: I was once forwarded an application for someone who was supposed to replace me, and I had to interview them. The expected salary was hidden by placing a gray rectangle over it. I removed it using inkscape and saw the expected salary was 30% higher than what I made. Inkscape Link: https://inkscape.org/ https://inkscape.org/
- Flashtoo 6y agoI'm curious how that interviewing situation worked out for you. Did you use it to negotiate a higher salary there or at your next employer? No pressure if you don't feel like sharing that, of course.
- x32n23nr 6y agoOnce you put an employee in a position where the only way to get a salary hike is to change employers, there is no way back - you change employers. It worked out well for me, and AFAIK the role is not filled yet in the previous company.
- lowwave 6y agoInkscape to Illustrator is what GIMP is to Photoshop. Glade someone brought it. For most common tasks is there really a point even using Photoshop and Illustrator now days? Especially with the cloud direction they are moving towards.
- illender 6y ago@op line 105 on https://github.com/shashanoid/shashwatsingh.github.io/blob/master/index.html https://github.com/shashanoid/shashwatsingh.github.io/blob/m... is missing an 'l' and will cause you to not get your email from your personal web link
- jessmay 6y agoWait wrapping a lib you didn’t write and that hasn’t been updated in 5 years is now called “I made a text extractor”?
- jfk13 6y agoSo it claims to > Edit pdf like a word doc while preserving structure and format. While I'm sure there are cases where this works pretty well and can be very useful, it may be worth noting that -- just like every other tool in this space -- there will be many PDFs where it simply can't work. It'll be hugely dependent on exactly how the PDF-generating application/tool went about things. One simple example: suppose your PDF uses a specific font (not one of the standards like Times or Helvetica), so the PDF-generating tool embedded the font. (This is common.) Further, suppose the generating tool embedded a re-encoded subset of the font, including only the glyphs that were actually required. (This is also common.) Now, suppose the edit you wish to make involves adding a character that was not present in the original document -- let's say you want to change the date from "May" to "June". But the original document contained no occurrences of capital J (in this particular font/style), and so the capital J glyph is not present in the embedded font. No "PDF text editor" can get around this; the best you can hope for is a "J" in some fallback (such as Times) that may look terrible alongside the intended custom font. And as for edits that would require reflowing multiple lines of text, maybe inserting a new paragraph in the middle of a page, etc.... not much chance of this working out well. Yes, a tool like this can (in many cases) make it possible to make minor changes (perhaps fixing a typo or updating a word here and there). To suggest that it can "edit pdf like a word doc" seems patently false to me.
- blitmap 6y agoWould be neat to do font recognition against available web fonts to try go find a match, then convert the web font to truetype or whatever format the pdf used, and re-embed the front.
- saint-loup 6y agoI learned a lot from this article (discovered on HN I think): What's so hard about PDF text extraction? https://www.filingdb.com/pdf-text-extraction https://www.filingdb.com/pdf-text-extraction In a nutshell, PDF is fundamentally different than MS Word: it's a standard for visual layout, without notions of paragraphs or even words. As OP said, it doesn't mean the tool is useless. It could quite often come handy for myself.
- Hoasi 6y agoNeat, would be useful for students' homework.
- top_kekeroni_m8 6y agoI'll be honest, I thought the website was called simp df.. lol