How to Find Problems

Most printing problems occur when you make incorrect assumptions about the printer or the printing process. Some typical false assumptions include:

  • All paper is 8½ by 11 inches.
  • All pages have the same margin size.
  • All printers print at 300 dpi (dots per inch).
  • All print jobs are in portrait mode.
  • All print jobs print the complete document.
  • All print jobs are printed to completion.

First check your printing source code, since it is easy to find incorrect assumptions by looking at the code directly. Are there any assumptions made about the printer? About the resolution? About the paper? About the size of text? About the mode? Large constants in print code are usually a bad sign. Rather, the layout should be determined by information returned by the GetDeviceCaps and GetTextMetrics API functions. GDI objects should also be sized relative to this information as well. Don't use fixed width pens or draw with pixels, since such drawing is resolution-dependent and will be hard to read when printed on higher-resolution printers.

TIP
You can find many types of printing problems by checking for incorrect assumptions in your printing source code.

How does your code print individual pages? Can it render any page by itself? Does the code know where any page starts and ends? Do any variables require printing all pages to be set correctly? Are all GDI resources correctly created and destroyed? For color printing, note that popular color printers usually dither colors, so using the StretchBlt function is probably a bad idea. Graphics should be rendered to the correct size and drawn using the BitBlt function instead. Lastly, if your program prints page numbers, note that the first page typically does not have a page number.

If your program supports print previewing, you can use the print preview feature to perform most of your print testing. This technique saves you a lot of time and paper. With print preview, you can check all the pages, review output in both portrait and landscape mode, print individual pages, and print using different paper sizes. Don't have any A4 paper to test with? No problem—just select A4 paper from the Page Setup dialog box or Print Setup dialog box and test using the Print Preview command.

TIP
Use print previews to find many types of printing errors.

However, you can't find all printing problems using the print preview. Problems involving printer resolution, individual pixels, precise alignment, or even using the wrong device context and fonts (that is, using a display device context or fonts instead of the printer device context or fonts) will not show up in a print preview. So, now with real paper, you can finish testing. I recommend at least the following tests:

  • Print in portrait mode using a 300-dpi color printer.
  • Print in landscape mode using a 600-dpi black-and-white printer.
  • Print the last two pages of a document.
  • Cancel a print job.
  • Print using a printer without paper.

If your program makes assumptions about the printer status, printer resolution, page orientation, and number of colors, it will not print correctly in any of the above situations.



Developing User Interfaces for Microsoft Windows
Developing User Interfaces for Microsoft Windows
ISBN: 0735605866
EAN: 2147483647
Year: 2005
Pages: 334

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net