Printing Crystal Reports - Printer Drivers and Fonts
Printing Crystal Reports is a series of documents that explain how Crystal Reports behaves when viewing, exporting and printing. The series is authored by Donald Williams and Ludek Uher, both Senior Support Engineers at AGS Product Support. The documents apply to Crystal Reports 2013 and SAP Crystal Reports, Developer Version for Visual Studio .NET only.
This document builds on, and adds to the document Printing Crystal Reports - The Basics. This document provides explanation as to why Crystal Reports and most other applications for Microsoft Windows Operating Systems are dependent on printer drivers and fonts when printing documents, viewing documents and in the case of Crystal Reports exporting to other formats.
With this knowledge, report designers, application developers and other CR users who print on multiple platforms will be better equipped to design reports that will accommodate printer driver dependency and print consistently across multiple environments.
Significant parts of this document uses information from the SAP document Crystal Reports 5, 6,7 & 8 Printer Driver Dependency; How to design reports that print consistently in different PC environments. Additional documents referenced in this series of are listed in the introductory document Printing Crystal Reports . As well, there are many additions and new information applicable to SAP Crystal Reports 2013 and SAP Crystal Reports, Developer Version for Visual Studio .NET.
Printer Drivers and Fonts
Before considering printer, viewer and export issues with deployed reports and how to resolve such issues, it is necessary to review how Microsoft Windows Operating Systems handle printers and fonts.
The choice of font type in report design must be one of the first considerations. True Type and Open Type fonts would apply for the most generic usage reports. The Microsoft document What's the difference between TrueType, PostScript, and OpenType fonts?, explains the differences between the fonts and their best usage:
|What's the difference between TrueType, PostScript, and OpenType fonts?|
PostScript fonts are smooth, detailed, and of high quality. They are often used for printing, especially professional-quality printing, such as books or magazines.
Which font format will work best for me?
It depends. If you want a font that prints well and is easy to read on the screen, then consider using a TrueType font. If you need a large character set for language coverage and fine typography, then you might want to use an OpenType font. If you need to print professional-quality print publications, such as glossy magazines or commercial printing, PostScript is a good choice.
The following considerations must be made regarding font choices before designing a Crystal Report:
- Will the report be only viewed in the Crystal Reports designer on the report author’s computer?
- Will the report be viewed on other computers using the Crystal reports designer or the Crystal Reports viewer?
- Will the reports be printed?
- Will the reports be exported?
- Will the reports be used in a Visual Studio .NET Windows application?
- Will the reports be used in a Visual Studio .NET Web application?
- Will the reports be used with Crystal Reports Server or SAP BusinessObjects BI Platform?
- Will the report always use the same printer driver?
A note for Visual Studio .NET developers
Visual Studio does not support fonts that are not True Type or Open Type. PostScript-Type-1-fonts (.pfm, .pfb) are not supported by GDI+.From SAP KBA 1706167 - Error: Failed to export the report - when exporting to PDF file format:
When using Font, InstalledFontCollection, FontDialog and SystemFonts, the following font formats are not allowed by the .NET Framework:
OpenType (Microsoft fonts are allowed, Adobe fonts are not allowed)
PostScript Type 1
Use OpenType fonts from Miscrosoft only
Once a correct font is chosen for the report, the next consideration is; how will printer drivers affect my reports?
How MS Windows Applications Use Printer Drivers to Paginate a Document
All Microsoft Windows programs require a printer driver to paginate documents. Printer drivers measure font information, based on the particular font selected and the font’s point size. The printer driver applies values (in pixels) such as the average character height, character width, height of the ascenders and descenders, internal leading, external leading, and maximum character width and more to each of the font elements True type fonts can be sized to any height that is accepted by the printer driver. True type fonts are WYSIWYG type fonts meaning they can be printed exactly as they appear on the screen. For more information on True Type Fonts, search the Windows online help.
When a particular font is selected, the MS Windows program executes a GetTextMetrics API call that queries the printer driver. The printer driver returns the TextMetric structure that contains the elements mentioned above and their assigned values. A structure exists for all fonts and all point sizes of a specific font. Now that the MS Windows application has all of the font information, it can assemble or paginate the document.
Inconsistency may crop up because different printer drivers measure the same font differently. For example, if a TrueType font is realized (measured) on two printers that use the same printer driver and installed on the same version of MS Windows, the two fonts should have identical text metrics (the values, in pixels, of each of font elements should be the same). Problems may arise when:
•Two identical printers, but each one is using a different printer driver. Many printers can be driven using several different print drivers.
• Two different printers using the same printer driver. Some drivers can be used to drive several different printers.
• Two different printers using different printer drivers.
- One printer driver that uses the TrueType font while the other maps the TrueType font to a PostScript font (e.g. LaserJet in PCL mode versus LaserJet in Postscript mode).
• Two identical printers using the same printer drivers but each one is printing from a different version of MS Windows.
• Two identical printers where each printer is using the same printer driver, such as Hppcl5ms.drv, but the printer drivers are different versions.
- Two identical printers, two identical printer drivers, and two identical operating systems; however, the resolutions of the video drivers are different.
For example, a document using one printer driver may require six full lines to display a block of text; however, another printer driver that measures fonts narrower could result in the same block of text requiring less than six full lines. A third printer driver that measures fonts wider could require six full lines plus a seventh line to display the last one or two words.
Unicode Printer Drivers
Crystal Reports 9 and above use the Microsoft Unicode Script Processor library (USP10.dll), also known as Uniscribe. The Unicode Standard defines codes for characters used in all the major languages written today. Scripts include the European alphabetic scripts, Middle Eastern right-to-left scripts, and many
scripts of Asia. Additionally:
- Unicode provides a unique encoding for characters, no matter what the platform, program or language.
- Unicode is supported in many operating systems, all modern browsers, and many other products.
- Unicode enables a single software product or website to be designed to target multiple platforms, languages and countries without re-engineering. It allows data to be transported through many different systems without corruption.
- Uniscribe also handles scripts written from right to left, such as Arabic or Hebrew, and supports the mixing of scripts. Therefore, Crystal Reports, beginning with Version 9, can display multiple language characters.
Most older dot matrix printers are not Unicode compliant resulting in slow printing, incorrect print layout and other issues. If you are using a dot matrix printer, ensure that the printer driver is Unicode compliant and designed for the Operating System.
An Exercise in Printer Driver Dependency
To see an example of printer driver dependency, using MS Word, MS Excel and Crystal Reports create a few documents using:
- A word processor such as Microsoft Word.
- A spreadsheet application such as Microsoft Excel.
- SAP Crystal Reports.
- And/or other applications that you have installed.
1. Design these documents using your current printer set as the default printer. The information in these documents should completely fill the page and print right up to the margins.
2. Print and close the documents. Make a note of where the pages break and individual lines wrap the text.
3. Set up another printer and set it as the default printer. You do not need to have the actual physical printer present to set one up. If you do not have a second physical printer, you will only be able to view the examples on screen and compare them to your printed examples. If you can, make sure that the actual printer driver used by the second printer is different. Many printer drivers are universal drivers and are used to drive a number of different printers.
4. Open each of the three documents again and preview them without making any modifications to them. If you have access to two very different printers, take the opportunity to print the examples and compare them. Printing to a postscript printer using a postscript and a non-postscript driver will also yield similar results.
You will notice that while no information is lost, line breaks, width of the fonts, inter-line spacing, inter-character spacing, and page breaks, etc., will all be different. Depending on the drivers you choose for this exercise, the difference between the two sets of documents will vary from no difference at all to significant reformatting occurring.
The results of the above exercise will occur using all versions of MS Windows. Different programs and different drivers will illustrate varying degrees of difference. Also, the same printer driver used in a different version of MS Windows will yield different results.
As another example, instead of changing the printer driver for the second set of documents, simply change the video resolution. You will also notice differences. The important point to note is that different hardware and software environments interpret and print the same documents differently.
The choice of application, fonts, printer drivers, video driver, screen resolution, Operating System and more influence the way any document will print in a Windows environment. It is up to the author of the document, be it Crystal Report or other, to decide on the best way to construct the document – depending on the use case scenario.