Live data from Hacker News

Pdfsandwich

tobias-elze.de

51–60 of 65 posts

Re: Pdfsandwich

#51
post #6

Interesting. I've used ocrmypdf for this a lot - https://ocrmypdf.readthedocs.io/en/latest/

It's great and I use it almost every day: paperless-ng uses it in the background.

Re: Pdfsandwich

#52
post #41
post #34

I wonder if we (like in "humanity") can live without PDF at all? The format has so many flaws and problems it is practically unusable for any task except producing a paper copy, which is progressively obsolete with all the displays and e-paper readers and mobile phones.

Including security flaws, which is a big deal. I still have not figured it out how to sanitize pdfs in any reasonable way. (If someone has any suggestions here, please share.) Not to mention need to save file in original Adobe Reader ("do you really want to overwrite this file?') every time you add a comment.

Maybe this is good enough for your use case:

https://dangerzone.rocks/

It converts documents to just images, then converts those back to PDF, all in a sandbox.

Re: Pdfsandwich

#53
post #47

Earlier quoted context omitted.

yeah, consistency is very important in design. imagine sending your boss PSD or HTML files but their machines don't have fonts you use in your design.

Just like with PDF, you can embed fonts in HTML so everyone has the same font. But yeah, agree with your overall point, PDF is currently the easiest, most well-supported way of sending stuff that doesn't fudge around with the design. What you send someone is almost guaranteed to be what they see, unless they use some weird PDF reader.

An epic thing you can do with PDF though is show an image of the font you want to show, and have a super common font like Helvetica hanging out behind it, so the end-user doesn't even need to render the font, it's just an image.

Re: Pdfsandwich

#54

Using Pdfsandwich in college was like having a superpower. We would often be given PDFs with only image data. While my peers were still scrolling through and copying quotes by hand, I was there in seconds with Ctrl-F to find and copy/paste. Once you have text in the PDF, you can use any sort of text analysis tools. You can use tools to convert it to plain text and grep through, or anything else you want. That being s…

I've read books that were scanned with OCR. You learn to deal with typical errors that occur, but overall the texts were mostly accurate.

Re: Pdfsandwich

#55

Using Pdfsandwich in college was like having a superpower. We would often be given PDFs with only image data. While my peers were still scrolling through and copying quotes by hand, I was there in seconds with Ctrl-F to find and copy/paste. Once you have text in the PDF, you can use any sort of text analysis tools. You can use tools to convert it to plain text and grep through, or anything else you want. That being s…

Here's a tangentially related fun fact! Before you take the uniform bar examination in New York, you first have to take an at-home section called the New York Law Examination. There is a book[1] that covers all the New York specific law that could be on the examination. It used to be provided as a simple PDF, where you could potentially search it, but people seemed to feel it made the test too easy - since everything was in that book. So they made it an image PDF.

Then, they put a warning on their site saying that they explicitly consider it to be misconduct search the book (e.g., by making the book searchable with OCR):

> The NYLC/NYLE Course Materials are locked in a non-searchable format in accordance with the Board’s misconduct rule prohibiting candidates from electronically searching the Course Materials when taking the NYLE. If a candidate, because of a disability, uses a screen reader to access written material, please contact the Board office by phone (518-453-5990), mail, or fax.

Kind of silly, sure! They don't want you searching the book during the exam, but they're fine with you going through it. And, following passing the bar exam, there is a character and fitness process, so students are fairly terrified of doing anything unethical, particularly things the bar explicitly says is unethical. So, it's basically an honor system, but with a big stick (although I haven't heard of any actual enforcement). If you OCR it, brag about it to your friends, and your friends really hate you, I guess they could report it.

[1]https://www.nybarexam.org/Content/NewYorkCourseMaterials.pdf

Re: Pdfsandwich

#56

i have a question about OCR. is there a project that lets you define fields for doing ocr, i am thinking scanning invoices and defining that this line means the invoice number, this here means the item name, item rate, etc. many OCR software can scan this but not "understand" it to use it. ABBYY has something like this for scanning invoices so is there something for the foss folks?

InvoiceNet

https://github.com/naiveHobo/InvoiceNet

https://news.ycombinator.com/item?id=24118466

Re: Pdfsandwich

#57

i have a question about OCR. is there a project that lets you define fields for doing ocr, i am thinking scanning invoices and defining that this line means the invoice number, this here means the item name, item rate, etc. many OCR software can scan this but not "understand" it to use it. ABBYY has something like this for scanning invoices so is there something for the foss folks?

While trying to find a specific project I recalled, I encountered this list of projects which might be of interest: https://github.com/tstanislawek/awesome-document-understandi...

The project I had in mind was similar to this one but I can't remember the name currently: https://github.com/tabulapdf/tabula

However, if you're looking for a ML-based, invoice-specific project looks like the other comment to your reply might be more useful.

Re: Pdfsandwich

#59
post #41

Earlier quoted context omitted.

Including security flaws, which is a big deal. I still have not figured it out how to sanitize pdfs in any reasonable way. (If someone has any suggestions here, please share.) Not to mention need to save file in original Adobe Reader ("do you really want to overwrite this file?') every time you add a comment.

Maybe this is good enough for your use case: https://dangerzone.rocks/ It converts documents to just images, then converts those back to PDF, all in a sandbox.

Thanks a lot! (Though it does not work for me.)

Re: Pdfsandwich

#60

i have a question about OCR. is there a project that lets you define fields for doing ocr, i am thinking scanning invoices and defining that this line means the invoice number, this here means the item name, item rate, etc. many OCR software can scan this but not "understand" it to use it. ABBYY has something like this for scanning invoices so is there something for the foss folks?

Windows only, but power automate lets you do this.
Post reply on HN