on 01-21-2009 5:50 PM
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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
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
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.