News for hackers. Stuff that matters.
Re:Show HN: PDFLayoutTextStripper – Converts PDF to text whi... by halomru on Saturday February 25, 2017 @06:32AM (#13731117)
PDF is a perfectly fine and rich digital format. It also allows you to do proper copy and paste, which is much saner than anything paper offers.

Sure, PDF is a light on context clues for automation and is targeted purely at humans. But formats targeted at both computers and humans consistently fail (XML with accompanying XSLT comes to mind), and/or only have terrible tools for creating files (easily parsable, pretty HTML).

Either there is very little real demand or we consistently fail at making alternatives viable.

Re:Show HN: PDFLayoutTextStripper – Converts PDF to text whi... by TeMPOraL on Saturday February 25, 2017 @06:39AM (#13731144)
> It also allows you to do proper copy and paste, which is much saner than anything paper offers.

Technically it does that, yes. Rarely do I see people taking advantage of it, though; most of the times I tried to copy some text out of PDF, the result had to undergo a significant cleanup before becoming usable.

Re:Show HN: PDFLayoutTextStripper – Converts PDF to text whi... by saghm on Saturday February 25, 2017 @11:01PM (#13735596)
I've had similar experiences, as well as worse; one PDF I got from a bank about my student loans a year or so back had ostensibly only text content, but none of it was even able to be selected.
Re:Show HN: PDFLayoutTextStripper – Converts PDF to text whi... by ptaipale on Saturday February 25, 2017 @07:26AM (#13731292)
PDF is not very fine. Copy-paste from PDF very often results in complete rubbish, even when it is not deliberately prevented (which the format allows, and then you have to do OCR).
Re:Show HN: PDFLayoutTextStripper – Converts PDF to text whi... by halomru on Saturday February 25, 2017 @08:00AM (#13731376)
People purposefully disallowing copy-paste isn't a problem with PDF: in other formats they would have embedded a picture, at least with PDF you get the other advantages of proper text: infinite zoom and great compression. Sadly there's also a lot of PDFs that are little more than a picture collection that looks like text, but that's hardly the file format's fault.

It really is a problem with PDF that it's too easy to get a file where copy and paste yields a different result than what's displayed. But this varies widely with the software used for creating the file (e.g. latex ligatures never work in copy-paste)

Re:Show HN: PDFLayoutTextStripper – Converts PDF to text whi... by fiatjaf on Saturday February 25, 2017 @08:15AM (#13731429)
When the PDF is a picture collection that looks like text that's when PDF is being used correctly, because that's when something was scanned out of paper and put on a paper-like format for computers, PDF.

When people write text and data and tables on the computer then put it on a paper-like format to share that's when the problem happens.

Re:Show HN: PDFLayoutTextStripper – Converts PDF to text whi... by maxxxxx on Saturday February 25, 2017 @02:02PM (#13733145)
Have you ever actually tried to parse PDF with software? It's a sheer nightmare. PDF often gets produced from text processors that have very rich format information. PDF strips it all out and then you somehow have to recreate it.
Re:Show HN: PDFLayoutTextStripper – Converts PDF to text whi... by maxxxxx on Saturday February 25, 2017 @01:42PM (#13733039)
PDF has no paragraphs, often not even words. No concept of font notes. It doesn't flow well with different screen sizes.

If you designed a real bad format on purpose, it would be hard to top PDF. Maybe Photoshop files are worse.

Re:Show HN: PDFLayoutTextStripper – Converts PDF to text whi... by brianwawok on Sunday February 26, 2017 @10:38AM (#13737680)
Have you seen the spec for .doc and .xls ?
Re:Show HN: PDFLayoutTextStripper – Converts PDF to text whi... by maxxxxx on Sunday February 26, 2017 @01:08PM (#13738627)
I don't even want to know :)
Re:Show HN: PDFLayoutTextStripper – Converts PDF to text whi... by grkvlt on Monday February 27, 2017 @09:23AM (#13744373)
Oh, you really do! The format for COM object based documents like XLS and DOC is actually a FAT filesystem: https://en.wikipedia.org/wiki/Compound_File_Binary_Format
Re:Show HN: PDFLayoutTextStripper – Converts PDF to text whi... by fiatjaf on Saturday February 25, 2017 @08:13AM (#13731422)
HTML is a viable alternative. And it is something everyone can parse easily, better yet if the data is tagged with classes somehow.
Re:Show HN: PDFLayoutTextStripper – Converts PDF to text whi... by fiatjaf on Saturday February 25, 2017 @08:19AM (#13731446)
That's something that should be pushed by the developer community, I think. Perhaps having an HTML client for people who nowadays use PDF writers and readers, with the option to tag data in some easily parseable format (if the data isn't already coming in a table).

This should output a single file and ideally it should have some way of ensuring the author it won't be modified unnoticed (that's one of the features common people use PDF for, today, they think it is something no one can modify) -- perhaps signing it with a key from Keybase would work in the mid term.

https://github.com/iffy/lhtml has something going in this direction.

Re:Show HN: PDFLayoutTextStripper – Converts PDF to text whi... by scrollaway on Saturday February 25, 2017 @08:25AM (#13731484)
epub is html-based, and their standards body recently got absorbed by the W3C. I think it would be a fine replacement for some of the uses that PDF gets (such as distributing research papers). Unfortunately I don't see it happening any time soon, PDF is so ubiquitous right now and there's very few tools that let you "save to epub". Chicken & egg.