Is there a list of open source PDF libraries for various languages? And related: the best tools to generate PDFs from HTML.
Show HN: I am building a new Python library to read/write PDF files
81–90 of 126 posts
Re: Show HN: I am building a new Python library to read/write PDF files
#82This reminds me back in the day where we got some properties and thought, PDF is a defined file format. Every pdf has this values… We were so naiv and didn’t know.
Re: Show HN: I am building a new Python library to read/write PDF files
#83I 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.
I use the method with `canvas.clipPath(path, stroke=False, fill=True)` on a path I've parsed manually from SVG then `canvas.linearGradient`.
Re: Show HN: I am building a new Python library to read/write PDF files
#84Earlier quoted context omitted.
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…
PDF is a subset of Postscript, which is a full-blown programming language disguised as a page description language. 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…
That’s a bit of an oversimplification. There’s a whole layer of structure atop the postscript subset. Much software deals only with that layer, never looking into the chunks of rendering code. That’s plenty complicated already!
> Postscript (and PDF) are also postfix, which can be confusing.
I handwrote quite a bit of postscript wsy back when. It wasn’t that bad, really, you just had to keep the state of the stack firmly in your head. Being used to HP scientific calculators helped. I would never dream of handwriting a pdf file, though. Even the low level parts are harder to deal with, since most command names have been shortened to a single letter for efficiency.
Re: Show HN: I am building a new Python library to read/write PDF files
#85I never knew about the J number suffix in python: https://docs.python.org/3/reference/lexical_analysis.html#im... which it would appear is used to represent references: https://github.com/desgeeko/pdfsyntax/blob/main/tests/test_p... I wish you good luck, this file format has tripped up many, many a developer. It blew up on a pdf I had lying around: ValueError: could not convert string to float: b'5.0.0' 104 0 obj > e…
J is for complex numbers. While math.sqrt(-1) raises an exception, cmath.sqrt(-1) returns 1j. There is not distinction between values and references in python, everything is a reference. In fact, primitive like numbers are big struct objects in cpython, you cannot just manipulate the raw numbers. The difference will rather wether you can modify an object or not. You cannot modify numbers, as they are immutable. Any i…
Re: Show HN: I am building a new Python library to read/write PDF files
#86from a past project we‘ve left a python PDF renderer - might be somehow useful or inspirational…
Re: Show HN: I am building a new Python library to read/write PDF files
#87Re: Show HN: I am building a new Python library to read/write PDF files
#88That shit was hard. Writing PDF is one thing but there are some psychopathic PDF's out there when you scratch below the surface. People do .... well, you'll find out.
Re: Show HN: I am building a new Python library to read/write PDF files
#89Is there a list of open source PDF libraries for various languages? And related: the best tools to generate PDFs from HTML.
As I'm currently fighting with css3/paged media[pm] - I've recently tried to figure it out. Theres a rather comprehensive list at: https://www.print-css.rocks/tools As far as Foss tools go, I've only found paged.js (a polyfyll) in combination with a browser print-to-pdf (eg wkhtmltoodf (webkit) or puppeteer (chrome)) that has any semblance of css support. There's also ghostscript - but AFAIK it doesn't support much/a…
Re: Show HN: I am building a new Python library to read/write PDF files
#90Maybe this will be the good solution