NewDeal Hot Tip 1808

[Hot Tips for...] Printing

Print Spooling in NewDeal

Print spooling is an integral part of the way NewDeal software works. It is not possible to "turn off" spooling in NewDeal.

What goes into the NewDeal spool files in the \privdata\spool directory are special codes that represent the raw drawing commands (like "draw a circle centered at 300-206" or "draw a three-pixel line from point A to point B"), not the data that ultimately gets sent out to the printer. The spooler then takes those commands and runs them over and over, drawing a bitmap in memory that is like a window onto the page, then the spooler works with the printer driver to translate the bitmap into printer codes and send them to the printer.

You may have read that NewDeal uses a "single imaging model." If you are like me, you probably said, "Oh, that's nice" and scratched your (balding) head and went on to the next paragraph.

Most software takes the document data and converts it directly to printer commands and sends those commands immediately to the printer. That can be a time consuming process which ties up the full attention of the computer's processor. Most print spoolers take the printer commands, just as they would be sent to the printer, save them in a disk file and then dole them out a little at a time to the printer in the background (in between other processes while you're working). That can create some very large files on your disk.

In NewDeal, the print spooler is an integral part of the printing process. What is stored in the spool file on disk is not the final printer commands, but rather, a collection of data that describes the page. If you print-to-file, the resulting file contains the actual printer commands that would have been sent to the printer. If you compare that printed-to-file file with the corresponding spool files in \privdata\spool, you'll see that the printed-to-file file is much larger.

Your NewDeal document file contains the raw data: for example, some ascii text and an "escape string" which is a series of numbers that NewDeal interprets as "the following text will use font number 777 and will be italic and left justified, with tabs at every half inch."

When it comes time for NewDeal to display the document, for example when the screen needs to be redrawn or when the user wants to print, then NewDeal reads the document data and converts it into a Graphic String.

A Graphic String is still vector data. It's not a bitmap, not a series of dots. Instead, it's a description of the page in a special NewDeal language. It's a series of commands, like "draw a curve of radius r, at location x,y" or "draw a line of length l, starting at position a,b and heading in direction q" all coded in a special language that NewDeal can interpret. In the case of text, for example, the font files, the font driver, the spline library, the styles library, the graphics object library, and the text library all work together to convert the ascii text and the escape strings into the vector Graphic Strings.

If the document is to be displayed on screen, the Graphic String is created in memory and then the video driver converts the Graphic String into dots, at 72 dots per inch, and sends the dots to video memory, and bingo, it shows up on the screen.

The Graphics String, being just a series of vector drawing commands, doesn't know or care at what resolution it will ultimately be used. It's the video driver which converts the Graphics String to a series of dots at 72 dpi.

If the document is going to be printed on paper, then NewDeal creates the exact same Graphic String, but this time it stores it on disk, in the spool files. The spool file doesn't know or care what printer will be used or what resolution it will print. The spool files are simply disk files containing the Graphics String. This is why NewDeal is said to use a "single imaging model." The Graphic String is the "single image" used by both the video drivers and the various printer drivers to create the end result.

Then, the spooler (spool.geo) works with the appropriate printer driver to convert the spool files (the Graphic String) into the correct printer commands to recreate the page on paper. This takes place in the background, a little at a time, which generally is about the same speed at which the printer can receive data anyway.

Why this fancy two-step dance? Why not just convert the document data directly to printer data?

Well, for one thing, it takes much longer to do the whole process than it takes to do part of it. When printing, you've probably noticed the dialog box that appears and reports "Page 1, Page 2," etc. That's the Graphics String being created in memory (it's next saved to disk in the spool files). And the Graphic String already needs to be created for the video driver to use, so by designing the printer drivers to use the same Graphic Strings, NewDeal makes double use of the same code, keeping NewDeal small and fast, and returning to the user to work, while the rest of the processing takes place in the background.

Well, then, why not store the Graphic String directly in the document files?

In the case of objects created with the drawing tools, that's pretty much what NewDeal does. But in the case of text, the Graphic Strings would have to be translated back into ascii and escape strings every time the user changed the font or style or updated the margins or tabs. So the creation of the Graphic String is a one way street.

Why not store both the ascii data and the Graphic String in the document file?

Because it would make the document that much larger, and it would take more time and more code to update both sets of data as the user worked on the document.


Return to Index

Last Modified 6 Mar 1999