“Sometimes required, otherwise optional”

This Yogi Berra-esque annotation next to a particular value in a PDF data structure included in the PDF document specification sent me for a little ride last night.

I noticed this while reading a particular section in the PDF document specification, and ended up laughing myself to tears. I’m sure part of that was the tiredness (we’re grinding out some pretty long hours working on some nifty new features for PDFTextStream v1.4), but a good chunk of it was the absurdity of the language used and what it implies for the ’specification’.

“Sometimes required”? First, that just doesn’t make sense on the face of it, at least not without some definition of what ’sometimes’ entails; second, stuff like this makes for unnecessarily-complicated implementations of a specification. Of course, the annotation was explained in detail, and any serious developer would be able to handle its repercussions with aplomb. But not all software is written by serious people. For proof of that, just look at the hundreds of thousands (millions?) of PDF documents out there that contain off-by-one kinds of “errors” that fall into gray areas of the PDF spec, but are consumed without problems by a variety of applications (including Acrobat Reader and PDFTextStream).

(For PDF-heads out there, this annotation is associated with the /I value in a choice field dictionary, described in Table 8.71 of the PDF spec.)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s