PDF for C and C++ Developers
"[I]t is pretty miraculous to be able to send something exactly as you want it to anyone and have them be able to see the same thing." That's what one of my clients just wrote me, reflecting on how PDF capabilities have enhanced our project since the '90s. He's right, of course, and his sentiment is common among the managers and end users who remember how messy it once was to get What You See and What You Get to match.
Many programmers regard PDF as mostly a nuisance, though. That's partially true, too; most organizations only know PDF as the output of a human-driven, and therefore at least mildly unreliable, process. PDF is just another "opaque" file type, one having little to do with programmers' concerns.
Remember, it's just a partial truth. In fact, PDF is programmable: With a little concentration, you can automate production of PDF documents, examine them, decode them, and so on. This article shows you how easy it is to get started.
Background
Let's be clear, first, on our terms. In 1992, Adobe System Incorporated built on the fantastic success of its Postscript (PS) language aimed at print specification with a new standard: PDF. PDF standardizes output not just to printers, but to monitors and a variety of other output media. At a technical level, PDF is something like a compressed, authenticated PS.
Most of us think of PDF as a "Web format." The most common Web format is HTML (hypertext markup language). It's flexible and easy to writeand every Web browser gives its instances a different appearance. PDF's achievement is this: PDF documents look the same in all Web browsers. As much as possible, they even look the same when printed out on any printer. That's a crucial property for many documents, and PDF has been enormously important in the success of the Net.
How do people make PDF documents? Mostly, they use their everyday tools, and compose the word-processing or spreadsheet or presentation instances with which they're familiar. Then, at the end of the process, they hit a special button, and the document appears as .PDF rather than .DOC or .XLS or so on.
That's not the only way, though. Adobe specification of the PDF standard is a public one. Any sufficiently clever process has the potential to write well-formed PDF. In the next few minutes, for example, you'll write a C program that generates a small but complete PDF document.