On the field of PDF parsing, I think the most interesting project I encountered is pdfquery[1], where the PDF is parsed as a XML tree and you can use XPath to query it. You might encounter rough edges when put it into production work but the idea is like “how come i never thought of this” because PDF has some tree like structure and should be a straightforward solution. [1]: https://github.com/jcushman/pdfquery
There is a command line utility (pdf2text) that will also parse the pdf to an XML tree and you can query with XPaths. I found it works well. https://pdfminersix.readthedocs.io/en/latest/reference/comma...
Show HN: I am building a new Python library to read/write PDF files
51–60 of 126 posts
Re: Show HN: I am building a new Python library to read/write PDF files
#52In particular, there are so many PDF libraries/tools that simply hide all the structure and try to provide an easy interface to the user, but they are always limited in various ways. Something like your project that focuses on parsing and browsing is really needed IMO.
Re: Show HN: I am building a new Python library to read/write PDF files
#53I’ve done a bit of PDF wrangling in Python, so figured I’d describe the lay of the land. PyPDF [1] is great for reading and writing PDF files, especially dealing with pages, but it’s not great for generating paths, shapes, graphics, etc. However, reportlab [2] has a great API for generating those things, but is lacking in the file IO and page management department. But the content streams it generates can be plugged…
Re: Show HN: I am building a new Python library to read/write PDF files
#54Re: Show HN: I am building a new Python library to read/write PDF files
#55Re: Show HN: I am building a new Python library to read/write PDF files
#56I 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.
Re: Show HN: I am building a new Python library to read/write PDF files
#57I 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
#58I 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.
Re: Show HN: I am building a new Python library to read/write PDF files
#59Re: Show HN: I am building a new Python library to read/write PDF files
#60I’ve done a bit of PDF wrangling in Python, so figured I’d describe the lay of the land. PyPDF [1] is great for reading and writing PDF files, especially dealing with pages, but it’s not great for generating paths, shapes, graphics, etc. However, reportlab [2] has a great API for generating those things, but is lacking in the file IO and page management department. But the content streams it generates can be plugged…