Utah and New Mexico

More new photos posted:

All from my road trip in May. Still to come, pictures from White Sands and the graduation ceremonies.

Bryce Canyon photos

Here are some photos from the rim of Bryce Canyon taken on my May roadtrip.

Portable Text Printing

I may need to develop a program that generates nice-looking printed output. Specifically, exam booklets from a database of existing multiple-choice questions.

Ideally, the resulting program:

  • runs on Windows, Mac OS X, and Linux, at a minimum
  • can be distributed at zero cost, under an open-source license
  • is self-contained and doesn’t require any unusual setup to run
  • is relatively idiot-proof for the operator
  • doesn’t require any expensive development tools to create
  • isn’t too obscure for future developers to deal with
  • works smoothly with the native printing scheme on each platform

And, of course, it should be EASY to create, because this is a volunteer effort and I’m lazy.

I need control over page breaks, so I can avoid page breaks in the middle of an exam question. I can see two ways to approach that. The easiest thing would be if the procedural code just generated some sort of markup language and passed the marked-up exam to an off-the-shelf formatter. The markup language would have to be rich enough to include the notion of a region that excludes page breaks. The alternative would be to have sufficient integration between the procedural code and the printing system to permit the code to ask about the printed height of a chunk of text. It could then force a page break where needed.

In some cases I also need to include a small graphic with the question.

The problem is almost solved by generating LaTeX code. That would certainly be powerful enough to handle formatting the page exactly as desired. Unfortunately, LaTeX printing is not natively supported on any of the target platforms, and the existing LaTeX packages are somewhat unwieldy. I suspect it would be a lot of work to hide a LaTeX implementation inside my program. A LaTeX-based solution would be great for savvy users, but it wouldn’t be nearly idiot-proof enough for the target audience.

HTML is better supported, but isn’t quite powerful enough. To capture the needed page headers and footers, I’d need CSS3’s Paged Media Module, and these features are not widely supported. Sigh.

It would almost be good enough to format plain text as if for a TTY. I could get all the control I needed by using a fixed-pitch font and formatting for 80 columns and 60 lines (which usually fits on a letter-sized page). Two problems: there would be no obvious way to include the graphics, and the results would be unavoidably hideous. Good enough for 1985, but not good enough for 2006.

If I could output RTF or PDF, that would be close to a solution. However, either of these languages would be a huge pain in the neck to generate, and the user would have to use a separate application to print the resulting file.

On any single platform, it would be easy enough, if tedious, to code for the native page layout system. But these systems are platform-specific. The truly mandatory platform is, of course, Windows (heavy sigh), and I don’t want to code for Windows only.

What to do?