Live data from Hacker News

Ask HN: Why is the PDF format so inaccessible?

news.ycombinator.com

101–109 of 109 posts

Re: Ask HN: Why is the PDF format so inaccessible?

#101
As others have already written, there is a free version of the PDF 1.7 specification available and using this you are (nearly) able to implement a PDF reader/writer. I wrote nearly because of the many malformed PDFs out there and because of some ambiguities in the spec that will have you look at certain parts of the implementation of existing libraries.

That said implementing a basic PDF reader/writer is not that complex and can easily be done in a few months. However, since you seem to also want to generate PDF pages with content, a whole lot of things have to be considered, like fonts (Type1, TrueType, CFF) and how to actually generate the content.

Adding some straightforward text using some built-in PDF font onto a PDF page is easy. But if you want to use a (subset) TrueType or OpenType font, have ligatures, contextual character substitutions, (LaTeX like) line wrapping, tagging for accessibility, ... you will open a can of worms ;-)

This is certainly also doable but gets quite complex and is the reason many PDF libraries only implement basic typographic features that are easy. You can probably count the PDF libraries supporting advanced OpenType typographic features on one hand...

However, if you are already in the process of writing a typographical software, this last part may actually already be done in your case. So if you have, as output from that software, the glyphs and their position, there is not that much complexity to implement and you could probably use a basic PDF library to do the PDF writing for you.

Re: Ask HN: Why is the PDF format so inaccessible?

#102
post #32

The PDF spec is officially available here: http://www.adobe.com/go/pdfreference There’s also this book which provides a good introduction and overview and is useful for understanding how the format works (although the PDF reference itself is pretty decent too, as far as specs go): https://www.oreilly.com/library/view/developing-with-pdf/978... (You can find a PDF copy if you look around.) EDIT: There’s also https://w…

I've always found it amusing from a "bootstrapping" perspective that the PDF spec is itself a PDF. That said, if you're only writing and not reading existing ones, it's as straightforward or as complex as you want to make it. I wrote a little program many years ago to convert plaintext to PDF in <1kLoC of C --- and its output was actually often many times smaller than what the commercial PDF-generators do, because I…

Just make sure that you follow the spec. Many such programs actually leave out mandatory parts of some objects, making the whole PDF invalid.

Re: Ask HN: Why is the PDF format so inaccessible?

#103
post #68
post #32

The PDF spec is officially available here: http://www.adobe.com/go/pdfreference There’s also this book which provides a good introduction and overview and is useful for understanding how the format works (although the PDF reference itself is pretty decent too, as far as specs go): https://www.oreilly.com/library/view/developing-with-pdf/978... (You can find a PDF copy if you look around.) EDIT: There’s also https://w…

It's certainly true that there are a lot of PDF renderers out there with subtle incompatibilities (and bugs), and also a lot of PDF files with subtle nonconformances. However, that doesn't seem like a good reason to not write a new PDF generator! Instead, write a conformant one. Better, write one that not only conforms, but also isn't affected by any of the bugs in popular PDF renderers, by testing against all of the…

Thanks for mentioning SPARCLUR - I didn't know that one and will certainly have a look at it.

Re: Ask HN: Why is the PDF format so inaccessible?

#104
post #32

The PDF spec is officially available here: http://www.adobe.com/go/pdfreference There’s also this book which provides a good introduction and overview and is useful for understanding how the format works (although the PDF reference itself is pretty decent too, as far as specs go): https://www.oreilly.com/library/view/developing-with-pdf/978... (You can find a PDF copy if you look around.) EDIT: There’s also https://w…

Thank you for the books and the suggestions. I understand the warnings since I did not really provide any information on my project in the post. Essentially, I am writing a batteries included language to act as a replacement for LaTeX (or at the moment, a small subset of it). I cannot use any existing library since they do not work for my own PL and I do not want to go through PostScript -> PDF since the reason I sta…

Which programming language are you using to write your LaTeX replacement? There are PDF libraries available in most languages (granted, there is wide spectrum of them with respect to how much/good they implement the PDF specification).

Re: Ask HN: Why is the PDF format so inaccessible?

#105
post #68

Earlier quoted context omitted.

It's certainly true that there are a lot of PDF renderers out there with subtle incompatibilities (and bugs), and also a lot of PDF files with subtle nonconformances. However, that doesn't seem like a good reason to not write a new PDF generator! Instead, write a conformant one. Better, write one that not only conforms, but also isn't affected by any of the bugs in popular PDF renderers, by testing against all of the…

Thanks for mentioning SPARCLUR - I didn't know that one and will certainly have a look at it.

It's brand new!

Re: Ask HN: Why is the PDF format so inaccessible?

#107
post #18

From the title, I thought you meant inaccessible as in providing little to no affordances for users of assistive technology (you know, accessibility, a11y… alt text, semantic markup, that sort of thing)

Ah, sorry. That's not what I meant -- in hindsight it does feel a bit clickbaity. But it doesn't look like there's any way for me to edit the title on HN.

Oh, no worries. I didn’t think of it as clickbait!

Re: Ask HN: Why is the PDF format so inaccessible?

#108
Aspose.PDF is great library for create and edit pdf documents :

https://products.aspose.app/pdf

and you can render your pdf documents online for free from many source formats in

https://products.aspose.app/pdf/conversion

for examle, this libraly generates documents from scratch with ISO specificaton from Adobe :

https://docs.aspose.com/pdf/net/create-document/

Post reply on HN