Archive for July, 2011

After playing with creating PDFs with PHP using fPDF for a while, and trying to get everything to work consistently, I discovered tcpdf, which is a fork of fpdf that includes everything that anyone has ever added to the original. And I mean everything; this thing is huge! I printed out the source to see how it differed from the original, and it ran more than 500 pages. Good thing they're so generous to me at work.

Most of the size is due to the SVG and HTML formatting, which I don't need, but the biggest advantage is that Unicode font subsetting works. Mostly.

tfpdf, the Unicode-enabled version that comes with fpdf, supports Unicode fonts but they don't show up on the iPhone. Apple's PDF viewer is somehow different from Adobe's and reads the fonts differently. tcpdf does a better job (displays in Adobe Reader but generates an error for the HumaneJenson font): the Droid fonts work on the iPhone, though the DejaVu fonts do not. Try those last links on the iPhone; the built-in Helvetica fonts show up but DejaVu does not. Try refreshing the test page multiple times; it randomly selects fonts to display each time. Some fonts generate errors in Adobe Reader but display, some don't display at all and some don't display on the iPhone. It all seems very random, but at least I have a set of open-source true type fonts that I can include.

It also does most of the things I need: PNG graphics with transparency, form fields like text boxes (I played with that one for weeks with tfpdf, but it never worked the way I wanted it to), rotating text. The API is clunky and poorly documented and I definitely like my routines better, but this is done and someone else maintains it. A huge advantage. I can write my own interface routines to be more elegant if I want.

Continue reading ‘Don’t Reinvent the Wheel, PDF Style’ »
XKCD has published the new reference standard for all flame wars: XKCD Connoisseur

I get lots of comment spam, either obvious ads for dubious products or boilerplate praise in almost understandable Engfish ("This is the most coherent soliloquy on this germane topic in the recent memory") with links to the ads. But I'd never seen comment spam that went out of its way to insult me:

The subsequent time I learn a blog, I hope that it doesnt disappoint me as much as this one. I imply, I know it was my choice to read, however I truly thought youd have one thing attention-grabbing to say. All I hear is a bunch of whining about one thing that you would repair in the event you werent too busy searching for attention.[links to some construction contractor removed]

I guess they know how humble I am and that I'd take criticism more seriously than praise.

But it's still painful to read something negative and have to take the time to parse it and realize it doesn't say anything at all, so I hope it doesn't become a trend. Thank goodness for Akismet!