SAP Knowledge Base Article - Public

1978881 - Printing reports using the .NET SDK PrintToPrinter method to Xerox and other printers is extremely slow

Symptom

At various sites when printing 160+ page reports to a Xerox Phaser 3635MFP PS and some HP printers using the Windows installed Drivers can take over 5 minutes to complete.

Environment

  • Windows 7
  • Windows 2008 R2
  • Crystal Reports Developer for Visual Studio
  • Visual Studio 2010
  • Visual Studio 2012

Reproducing the Issue

In a simple .NET Windows Form application using CR for VS runtime that opens the report, sets log on info and few parameters and then prints to the printer either from the Viewer Print button or using PrintToPrinter method. Can take over 5 minutes for a 150+ page report to complete.

 

Cause

To see what is happening enable crpe32 logging, see attached Knowledge Base article on how to enable logging.

Once the logs are complete open them in a text editor and look for similar lines:

|97238ec7-ed34-a204-d81a-9365df1cc7eb|2014 01 30 14:29:04:882|-0500|==| | |functions| 1124|5648|| ||||||||||||||||||||||0x1610 14:29:04.882 0 0 PEFreeEncapsulatedData 0 OUT encapsulatedData:9010000 25 <==

|e4872682-7d17-ce64-8b48-c5d5e10a7a0f|2014 01 30 14:29:07:723|-0500|==| | |functions| 1124|5648|| ||||||||||||||||||||||0x1610 14:29:07.723 0 PESetUserSessionInfo 0 PEUserSessionInfoW:<StructSize:262><userName:><requestID:26> IN 25 <==

Notice CR is sending the encapsulatedData info to the printer and 3 seconds later the printer is returning the completed request and then the next page is sent.

3 seconds times 150 pages equals 7 minutes for this report to print.

Comparing this to a different printer it is relatively done in a less than a minute.

Also Note: If the printer port is set to File so it saves the output to a PRN file the PrintJob completes in a few seconds.

Resolution

To verify this is a Windows Framework and Printer Driver issue run the attached Demo_PrintDocument. Source code and executable with a 150 page text file is included.

As you can see it too takes just as long, this emulates what the Viewers Print Button as well and the PrintToPrinter method is doing.

Use a printer driver that does not have issues. Xerox suggested using the generic HP printer driver as a work around.

See Also

1470978 - How to enable/disable crpe logging for the Crystal Reports .NET SDK

Keywords

Performance, Printing, Xerox, Crystal Reports for Visual Studio, CRforVS, PrintToPrinter , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , Problem

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio

Attachments

Demo_PrintDocument.zip