cancel
Showing results for 
Search instead for 
Did you mean: 

Inconsistencies between Crystal Designer Printing and PrintToPrinter

Former Member
0 Kudos

I am having some inconsistencies between printing to a text file from Crystal Designer and printing to a text file via the Crystal Reports SDK for .NET. I am using Crystal Reports XI Release 2 SP4 and when I print my report to a file, using a printer and the Generic/Text print driver, the report comes out fine. But when I try to print the same report to a file, using the same printer, via .NET code, the text looks like it is falling off the page. We are wanting to run a bunch of reports in batch and output them to text.

The report was written using a PCL printer and not the Text Printer.

Below is a snippet of my batch code:


ReportDocument report;

// Loading of the rpt file and setting of authentication credentials

System.Drawing.Printing.PrinterSettings _printerSettings = new PrinterSettings();
System.Drawing.Printing.PageSettings _pageSettings = new PageSettings();
report.PrintOptions.CopyTo(_printerSettings, _pageSettings);

// Set the report to use the print to file printer using the Generic/Text driver
_printerSettings.PrinterName = "TextPrinter";
_printerSettings.PrintToFile = true;
_printerSettings.PrintFileName = this.outputPath;

// Run the report
report.PrintToPrinter(_printerSettings, _pageSettings, false);

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

Couple of questions and a suggestion:

1) Is this a web app or a win app?

2) Are you seeing this behavior, on the development computer or after you distribute the app?

3) Are you using a local printer or a network printer?

See if setting the third parameter of the report.PrintToPrinter to "true" will help. E.g.;

report.PrintToPrinter(_printerSettings, _pageSettings, true);

Ludek

Former Member
0 Kudos

Ludek,

Thank you for the reponse. Here are the answers to your questions.

1. This is a win app

2. I am seeing this on both the development and deployed machines

3. The printer is local on both the development and deployed machines, is using the Generic/Text print driver and pointing to the FILE port so it prints to a file.

I have tried both false and true for the last parameter and received the same results.

former_member183750
Active Contributor
0 Kudos

Hmm. OK, re-reading the thread and discussing with others around here, it turns out that

report.PrintOptions.CopyTo is not available in CR XI r2. this is a new API introduced in CR 2008. However in your first post you say:

" I am using Crystal Reports XI Release 2 SP4 and when I print my report to a file..."

Can you check on the version of the CR assemblies referenced in your project?

Ludek

Former Member
0 Kudos

Sure. The assembly and versions are (I will give the Framework version as well):

CrystalDecisions.CrystalReports.Engine

Version: 11.5.3700

Runtime Version: v2.0.50727

CrystalDecisions.Shared

Version: 11.5.3700

Runtime Version: v2.0.50727

0 Kudos

Hi Tim,

The generic print driver that Microsofts installs on all PC"s may be different and I've heard it's not that good of a driver to use. Try setting the Printer to your local default printer or in the Report Designer check on either Use Default printer or no Printer. Sometimes this can fix issues between print drivers.

Thank you

Don

Answers (0)