?
Solved

Printing discrepancies between Crystal Report Designer and C# code

Posted on 2009-02-10
7
Medium Priority
?
487 Views
Last Modified: 2012-05-06
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.

Attached is a snippet of my batch code.

Thanks.
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);

Open in new window

0
Comment
Question by:DevMan
  • 5
  • 2
7 Comments
 

Author Comment

by:DevMan
ID: 23606269
Another piece of information that might help is that this is a console application, not a web app.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 23606463
Try changing the printer to the printer you are going to use to print to.

Crystal uses the printer driver to render the report.  Changing the driver can cause problems like this.

Maybe these articles will help

How Printer Driver Options Affect a Report
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a09051e9-721e-2b10-11b6-f9c65c64ef29

Printer Driver Dependency: How to Design Reports that Print Consistently in Different PC Environments
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/40e40899-721e-2b10-b084-c7ed76af46f1

mlmcc
0
 

Author Comment

by:DevMan
ID: 23606572
In both Crystal Designer and in my code, I am printing to the exact same printer and driver.  Does Crystal Designer perform some additional formatting before sending the report to the printer?
0
Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

 

Author Comment

by:DevMan
ID: 23606670
mlmcc,

Thank you for the link to the document.  I have gone back and modified my code to reset the page orientation and paper size when I set which printer to use, as recommended in the document.  That still has not fixed the problem.

For example, the report was designed with a CUSTOMER NUMBER label for a field.  When I print to the Text Printer from Designer, the label comes out as:

CUSTOMER NUMBER:

When I print to the exact same Text Printer from my code, the label comes out as:

CUSTOM N:
                 UMBER
0
 

Author Comment

by:DevMan
ID: 23606696
Both the Crystal Designer and .NET code are running on the same machine.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 23607019
I don't know.  I don't recall seeing anything in the Crystal KB about an issue like that.

I'll look to see if there is something.  Most of the issues are font size.

mlmcc
0
 

Accepted Solution

by:
DevMan earned 0 total points
ID: 23729612
I have discovered what the problem is.  The report was not designed in a manner which was not printer driver independent.  Modifying the report format appears to be resolving the solution.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Loops Section Overview
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question