cancel
Showing results for 
Search instead for 
Did you mean: 

How to print reports to the chosen printer using .NET, SAP Crystal reports Engine 64 bit on a 64 bit server (Win2k8)?

Former Member
0 Kudos

We have a windows application that is built on .NET remoting. It’s a 32 bit application built using .NET Framework 2.0. We are using SAP Crystal reports run time engine for .NET Framework 4 (32-bit – Version 13.0.3) for reports functionality. There is a printing functionality also which prints the respective report to the chosen printer by the user during the batch run . This entire setup works fine on a Windows server 2003 server. Now we are trying to migrate the application to Windows server 2008 , the printing is not working correctly. It is always printing the reports to the default printer on the Windows server 2008 machine instead of printing it to the chosen printer.

CrystalDecisions.CrystalReports.Engine, CrystalDecisions.ReportSource & CrystalDecisions.Shared are the DLL’s that are referenced from

C:\Program Files\sap businessobjects\crystal reports for .net framework 4.0\common\sap businessobjects enterprise xi 4.0\win32_x86

We converted the application to 64 bit version. On the Windows server 2008 even though we installed , SAP Crystal reports run time engine for .NET Framework 4 (64-bit – Version 13.0.3), the printing is not working correctly (Printing always to the default printer). Also couldn’t find the above DLL’s in the 64 bit installation folder.

C:\Program Files\sap businessobjects\crystal reports for .net framework 4.0\common\sap businessobjects enterprise xi 4.0\win64_x64

I couldn’t find any issue with code, I think it’s definitely a compatibility problem. I am stuck with this issue for more than a month. Please help.

Accepted Solutions (1)

Accepted Solutions (1)

former_member188030
Active Contributor
0 Kudos

Upgrade to CRforvs SP10. There are many issues fixed during SP3 to SP10.

The Install EXE is the same package to be used for development 32 and 64 bit. You should only change the target platform your app X86 or X64.

For deployment we have different MSI for 32 and 64 bit,.
http://scn.sap.com/docs/DOC-7824

Try a sample application using CR.NET or RAS SDK from below KBAs and see if you could reproduce the issue. If you do, make sure

- The user has permissions over the printer.

- Log in as an administrator and run the app to print to non default printer.

- Check No Printer option in the report.

http://search.sap.com/notes?id=0001561333&boj=/sap/bc/bsp/spn/scn_bosap/notes.do?access=69765F6D6F64...

http://search.sap.com/notes?id=0001783535&boj=/sap/bc/bsp/spn/scn_bosap/notes.do?access=69765F6D6F64...http://search.sap.com/notes?id=0001386475&boj=/sap/bc/bsp/spn/scn_bosap/notes.do?access=69765F6D6F64...

- Bhushan

Senior Engineer

SAP Active Global Support

Follow us on Twitter

Got Enhancement ideas? Try the SAP Idea Place

Getting started and moving ahead with Crystal Reports .NET applications.

Former Member
0 Kudos

Hi Bhushan,

Thanks for a quick reply. I have installed CRforVS_13_0 (for visual studio 2010), CRforVS_redist_install_32bit_13_0_10 & CRforVS_redist_install_64bit_13_0_10 on my local machine (Windows 7), built my x86 solution using Visual Studio 2010 Professional edition.

Deployed the same on the Windows server 2008 R2 server which has .Net framework 4 Client profile,.Net framework 4 extended, CRforVS_redist_install_32bit_13_0_10 & CRforVS_redist_install_64bit_13_0_10. Still the issue of always printing to the default printer persists.

Please look into.

Installables description:

CRforVS_13_0 - SAP Crystal reports, version for Visual studio 2010

CRforVS_redist_install_32bit_13_0_10 - SAP Crystal reports runtime engine for .NET Framework (32 bit)

CRforVS_redist_install_64bit_13_0_10  - SAP Crystal reports runtime engine for .NET Framework (64 bit)

Thanks & Regards,

Srinivas

former_member188030
Active Contributor
0 Kudos

On dev machine, install CRforVS_13_0_10.exe, no need to install any of the redist_installs.

recompile the app and deploy on server.

Did you try the steps from my last reply? How did the sample app behave?


Try a sample application using CR.NET or RAS SDK from below KBAs and see if you could reproduce the issue. If you do, make sure

- The user has permissions over the printer.

- Log in as an administrator and run the app to print to non default printer.

- Check No Printer option in the report.

http://search.sap.com/notes?id=0001561333&boj=/sap/bc/bsp/spn/scn_bosap/notes.do?access=69765F6D6F64...

http://search.sap.com/notes?id=0001783535&boj=/sap/bc/bsp/spn/scn_bosap/notes.do?access=69765F6D6F64...http://search.sap.com/notes?id=0001386475&boj=/sap/bc/bsp/spn/scn_bosap/notes.do?access=69765F6D6F64...

Thanks,

Bhushan

Former Member
0 Kudos

Hey, We found the issue and the fix. Its related to code.

string printPath = System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

string rptFileName=@"\sample.rpt";

string PrinterName=Console.ReadLine();

ReportDocument reportDocument = new ReportDocument();

reportDocument.Load(printPath + rptFileName);

reportDocument.PrintOptions.PrinterName = PrinterName;           

reportDocument.PrintToPrinter(1, true, 0, 0);

reportDocument.PrintOptions.PrinterName is always empty even the right printer name is assigned. The code has been changed as follows and the same worked on Windows server 2008 R2 with existing set installations (SAP Crystal reports 32 bit/64 bit version - 13.0.3) without even converting to 64 bit.

ReportDocument reportDocument = new ReportDocument();

reportDocument.Load(printPath + rptFileName);

System.Drawing.Printing.PrinterSettings printerSettings = new System.Drawing.Printing.PrinterSettings();

printerSettings.PrinterName = PrinterName;

reportDocument.PrintToPrinter(printerSettings, new PageSettings(), false);

Thanks for your inputs!

Best Regards,

Srinivas

Answers (0)