I once had to help an accountant friend to fill in 1000's of docx files, and convert them to pdf. No open source tool does a proper conversion, it really sucked.
Show HN: I am building a new Python library to read/write PDF files
61–70 of 126 posts
Re: Show HN: I am building a new Python library to read/write PDF files
#62Re: Show HN: I am building a new Python library to read/write PDF files
#63I desperately need to be able to display .SVG files with gradients on .PDFs, but no library currently exist in python as far as I know. I would be willing to help make this happen, but I do not know much about the PDF format.
It's actually not so bad: it's mostly ASCII, even though some parts of it really need to be treated as binary. If you open up a simple/old PDF in your favorite text editor, you can begin to grok the basic structures quite easy. One trick for getting started: PDFs are read from the bottom. The first thing that is read is actually an offset pointing back to the xref table, at the end of the file. Then, the xref table i…
Re: Show HN: I am building a new Python library to read/write PDF files
#64I wish you all the best! This space has a lot of stuff in it and they’re lacking in some aspect. And that’s not a admonishment, PDF is such a complicated format that there will never be a library that doesn’t come with asterisks — it’s just a matter of picking the thing you want your library to focus on and be good at and you can pretty easily be someone’s favorite lib.
My understanding is that this is largely because you're fighting an adversarial format provider in Adobe, I've read a few papers and journal entries on file format polyglotting, with some focus on PDF and approaches are constantly shifting in nature due to Adobe mooting pathways to success, I think it's partly for security and also IMO partly for obscurity as PDF is a horrific format in all reality except for human v…
People who think of the format as "adversarial" are wrong. Adobe never gave a shit about being adversarial in that sense.
The problem is that PDF is not a file format, it's a defined subset of a programming language (PostScript) used for portable rendering with fidelity. It's portable, in the sense that it should render the same way on whatever device it's rendered on (printed on a page or mastered to a display). And it's portable because it doesn't allow any postscript job-level commands, and it tries to ensure that each PDF File is standalone and can be concatenated together into a multi-page document or embedded in another document.
Postscript (and PDF) are also postfix, which can be confusing.
Re: Show HN: I am building a new Python library to read/write PDF files
#65Why is the state of the art in PDF parsing SO BAD? This is an incredibly common and important problem. Tika and fitz have very poor results. What is the reason that this is still so backwards?
PDF has always seemed to be a janky Adobe product. Should a modern, open version of PDF be created knowing that how it evolved from the original concept in 1991? Shouldn't we at some point say, we need to start over and created PDF2?
And PDF is a subset of PostScript, the product that made Adobe and the DTP industry.
It's janky because the goal was to render identically everywhere. If you think it's easy look at the code abortion that is CSS.
Re: Show HN: I am building a new Python library to read/write PDF files
#66Re: Show HN: I am building a new Python library to read/write PDF files
#67Earlier quoted context omitted.
It's actually not so bad: it's mostly ASCII, even though some parts of it really need to be treated as binary. If you open up a simple/old PDF in your favorite text editor, you can begin to grok the basic structures quite easy. One trick for getting started: PDFs are read from the bottom. The first thing that is read is actually an offset pointing back to the xref table, at the end of the file. Then, the xref table i…
You can include binary data in PDF files, so it's not necessarily ASCII.
Re: Show HN: I am building a new Python library to read/write PDF files
#68Earlier quoted context omitted.
You can include binary data in PDF files, so it's not necessarily ASCII.
The structure however is still largely ASCII text. It needs to be treated as binary of course, due to the use of offsets everywhere and the fact that the xref table is hardcoded to have a specific length per xref in bytes. But if you look at a lot of simple or old PDFs, it's not hard to find some that don't use any binary encodings.
Re: Show HN: I am building a new Python library to read/write PDF files
#69Good luck! Really! I hate ReportLab! I hate using ReportLab … reading its code is fascinating. Interesting seeing what 1990s Python code looked like.
Re: Show HN: I am building a new Python library to read/write PDF files
#70I desperately need to be able to display .SVG files with gradients on .PDFs, but no library currently exist in python as far as I know. I would be willing to help make this happen, but I do not know much about the PDF format.