I have been hesitating writing a blog concerning the differences in printing from a .NET application and Crystal Reports designer for a bit. My hesitation in this was due to the chance that this will look negatively on our printing abilities, and whether I can write something short and clear enough about a topic that can be a pretty muddy and complicated.
I recently published a KBase article 154797 concerning this issue for a long and on-going case and thought I would take a stab at this. The kbase article sums this up nicely, it basically says "due to the fundamental differences between Win32 API and the .NET framework printing can be different".
To understand this better, it is important to know that Crystal Reports are formatted using the system's printer driver. This is true whether you are printing, viewing, or exporting. What this means different printers, OSs, driver versions can cause a change in the layout of the report.
Crystal Reports designer uses WIN32 API and windows Printer DEVMode structure when interacting with the printer. the DEVMode is the low level WIN API class to get all information from the printer and set the printer settings, and has been around since at least the Windows 95 days. Here is more information on the DEV mode structure if you really want it.
In VS .NET we use the System.Drawing.Printing classes and functions to set print information so we are framework compliant. The difficulty in this is that in the back end we have to convert from System.Drawing.Printing to the DEV mode structure for the CRPE32.dll to do its job. Unfortunately these two cannot always translate perfectly back and forth; this is where the "fundimental differences" lie.
We cannot change the print engine and Crystal designer to use the .NET Printing especially since our reports need to run on non-Microsoft OSs. Nor can we now change .NET to use DEVMODE, so this is going to be a difference that will not go away, all we can do is minimize the issues that may occour. Here are a few things that you can do:
For those that are thinking "There HAS TO BE something you can do to get .NET and Crystal to print exactly the same" let's look at it from a different angle. The .NET framework only supports True-Type fonts however in the Crystal designer you can design a report to use fonts not supported in .NET. When viewing this in .NET a font substitution will occour. Like the DEVMODE to System.Drawing.Printing there are differences in Win32 and .NET applications that just cannot be worked around.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
13 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 |