Live data from Hacker News

Show HN: PDFLayoutTextStripper – Converts PDF to text while keeping the layout

github.com

61–70 of 95 posts

Re: Show HN: PDFLayoutTextStripper – Converts PDF to text while keeping the layout

#62
post #49
post #7

Curious if this works better than the pdftotext utility that comes in the Debian poppler-utils package. That has a --layout option that works really well sometimes and really terrible other times. Doesn't seem to be related to document complexity either.

During the development I compared my results with the ones of pdftotext utility and i obtained more or less similar results. The objective of my code was to have an equivalent tool easily embeddable in any java/android project and to learn more about apache pdfbox.

I imagine it's not an easy task guessing about proportionally spaced fonts, overlapping bounding boxes, columns, tables, wrapping, and so forth.

Re: Show HN: PDFLayoutTextStripper – Converts PDF to text while keeping the layout

#63
post #35
post #13

Earlier quoted context omitted.

You can use the SHA-1 of the PDF's to avoid serving the same pdf twice.

You've been away from HN a few days? The SHA-1 collision example uses PDFs in its demo. Hence other commenter saying SHA 256

The OP was almost certainly being sarcastic.

Re: Show HN: PDFLayoutTextStripper – Converts PDF to text while keeping the layout

#64
post #38

Although I haven't tested this yet, these utilities tend to fail when fed a table with empty cells.

The first example image in the linked article shows a conversion from a table with some empty cells. It looks fine.

Those are at the end. I meant empty cells in the middle. The ones I tried don't account for them.

Re: Show HN: PDFLayoutTextStripper – Converts PDF to text while keeping the layout

#65
post #35

Earlier quoted context omitted.

You've been away from HN a few days? The SHA-1 collision example uses PDFs in its demo. Hence other commenter saying SHA 256

The OP was almost certainly being sarcastic.

For clarity can you edit your comment to add cozzyd (the OP you mention) - I am sometimes sarcastic but not in this case. I'll then delete this comment.

Re: Show HN: PDFLayoutTextStripper – Converts PDF to text while keeping the layout

#66
post #62
post #49

Earlier quoted context omitted.

During the development I compared my results with the ones of pdftotext utility and i obtained more or less similar results. The objective of my code was to have an equivalent tool easily embeddable in any java/android project and to learn more about apache pdfbox.

I imagine it's not an easy task guessing about proportionally spaced fonts, overlapping bounding boxes, columns, tables, wrapping, and so forth.

yes, definitely not easy but fortunately pdfbox offers a solid base to start with.

Re: Show HN: PDFLayoutTextStripper – Converts PDF to text while keeping the layout

#67
post #5
post #2

who would be interested by an online website doing the job?

For what it's worth, here's a service that does that https://documentalchemy.com/demo/pdf2txt (and more: https://documentalchemy.com/demo )

Just tried the demos on this website.

I tried to extract text from a pdf that already has searchable text, which can be copy-pasted. This should be the easiest task of all but it made mistakes in every second word.

Then I asked the website to make a pdf into a word-file. It just inserted the whole pdf as a picture in word.

Re: Show HN: PDFLayoutTextStripper – Converts PDF to text while keeping the layout

#68
post #38

Earlier quoted context omitted.

The first example image in the linked article shows a conversion from a table with some empty cells. It looks fine.

Those are at the end. I meant empty cells in the middle. The ones I tried don't account for them.

It works also with empty cells in the middle.

Re: Show HN: PDFLayoutTextStripper – Converts PDF to text while keeping the layout

#69
post #16

For those interested in converting PDF tables into CSV, there's also Tabula ( http://tabula.technology/ ) (Used by many journalists to analyze the data in PDFs)

I find it absolutely ridiculous that we have to resort to these kinds of tools :/ We have digital formats, and we decided to standardize document distribution on the one that makes it as hard to extract data as if it were on physical paper.

It's because PDFs have no concept of lines or paragraphs. It's just characters at an x,y co-ord which happen to line up. So figuring out whats a line or a column is a pain in the ass.

That's most likely why copying and pasting sucks too.

Re: Show HN: PDFLayoutTextStripper – Converts PDF to text while keeping the layout

#70

Earlier quoted context omitted.

I find it absolutely ridiculous that we have to resort to these kinds of tools :/ We have digital formats, and we decided to standardize document distribution on the one that makes it as hard to extract data as if it were on physical paper.

It's because PDFs have no concept of lines or paragraphs. It's just characters at an x,y co-ord which happen to line up. So figuring out whats a line or a column is a pain in the ass. That's most likely why copying and pasting sucks too.

Yes, and more when you want to send a PDF based document to a Kindle.
Post reply on HN