Fun with PostScript and PDF
A couple of weeks ago, I needed to make a big PostScript file (4×3m, more on this later), and it seems like InkScape won’t let me use an arbitrary format. So I went ahead, googled for a PostScript tutorial, got the BlueBook as the first result and downloaded the reference manual for PostScript level 3 from Adobe.
I must say that PostScript is really a fun language to play with, and I had quite some fun doing something that would have been pretty boring otherwise. Enjoy the power of a complete programing language to automatise a couple of things while you’re at it.
I eventually had a look at the DSC and EPS specifications too, and ended up reading the PDF reference for PDF 1.6. I’m quite disappointed they scrapped the “PostScript is a complete programing language” part. I’m also quite disappointed by the “let’s use byte offsets in the xref table”, which is really painful to manage when writing a PDF file with a text editor, but I admit that it’s probably the best solution.
So, it was time for a cool hack using what I gathered about PS and PDF. Here it is, I added EPS and PDF as output formats for the screenshot in TiLP; the screenshot is written as a raw RGB (or black & white) inline image, compressed with zlib and encoded in ASCII85.
I wish I had learned all of this a year ago, when I had to debug a printing problem with CUPS. Now I can tell what the bug was; CUPS wasn’t honoring the DSC indicating the next page was to be printed on A3 paper with landscape orientation. Instead, the stupid thing added a DSC telling the page was to be printed on A4 paper. If this bug still exists, I’m going to send them a dead-tree copy of the DSC specs, so they can bang their heads against it :-P