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?

Comments (2) to “Portable Text Printing”

  1. Does the test HAVE to be printed? Could it be taken online? Would that be easier to work around?

  2. It has to be printed, for our purposes. The FCC rules require that the test be given in person (with three qualified examiners and all sorts of other safeguards). We could use computers “live” to administer the exams, and some teams do that routinely. Locally, we have found that paper booklets are better. Many of the applicants are more comfortable with paper, and it’s a big problem to bring enough computers to a test site to support more than a very small number of applicants. With booklets we can easily have a dozen or more applicants working on taking the test simultaneously. Beyond that the manual paperwork for the examiners (grading, creating pass certificates, and preparing the documents for filing with the FCC) becomes the bottleneck.

    That bottleneck happens after the applicants are done taking their tests. That’s a much better time to have a bottleneck. The applicants aren’t hyped up waiting to take the test, and they really have no choice but to wait for the paperwork, and they can see the examiners working as fast as they can to catch up on the paperwork.

    Yes, it would be MUCH easier to create an on-screen exam program. There are many choices for cross-platform GUI development. A true online (network) application would in some ways be even easier, since the environment (on the server) would be completely under my control, and the browser is a fairly well-known quantity. Too bad that doesn’t meet the requirements for this project.

Post a Comment
*Required
*Required (Never published)