SAP Knowledge Base Article - Public

2163438 - How do I make Crystal Reports for Visual Studio print my reports?

Symptom

Over the years there have been various SDK's based on various platforms and the current one uses the Framework System.Drawing.Printing

In a Windows Desktop application and Crystals Winform viewers Print report Button default is using PrintToPrinter API, same one that can be used in code.

There are limitations within this method so a Report Application Server ( RAS ) API called PrintOutputController can be used to allow more customized printer selections and features.

To expand on the Crystal Reports Printing Doc two SAP employee's have created here is the "how to" when printing through our .NET SDK.

https://blogs.sap.com/2019/05/31/printing-crystal-reports/ ( Update - Printing labels wiki has been added )

This document will also link to this KBA to get the sample application I have created to show you what is happening within CR for .NET.

For now I have noted most of the subroutines so it should be self explanary but look for the updated Document for detailed info.

Also notice you can get the history of your reports through the drop down list. This is required because some of these updated printer properties require the reports to be saved in CR Designer or in CR for VS Designer.

Environment

  • Crystal Reports for Visual Studio SP 13 ( requires SP 14 so a slight modification is required before compiling - SP 14 should be out end of June 2015 )

Resolution

Install Visual Studio 2010 -> 2017

Install the Crystal Reports for Visual Studio SP 14 from this link:

https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads

First link is the installer into VS, all others are for redist only.

NOTE: To run just the executable browse to this folder: \RAS2010_Printing\bin\Release and double click on RAS10_CSharp_Printers.exe

Using BOE .NET SDK also works the same way.

PrintOutputController ( POC ) uses the same Printing Dialog box as what CR Designer uses.

Update: 5/21/2015 - added Duplex values with ability to save the changes

WARNING - you must select the same value Report has when using Set Printer, P2P or POC buttons. It will over write what is saved in the RPT.

Update: 5/29/2015 - Changed Duplex logic - added check box to apply duplex change when Setting Print Options or using Print To Printer or POC

Update: 6/9/2015 - added PrintToPrinter (P2P) which is the default printer method used in our viewer, or POC check box for the viewer to use with its Print Button

Update: 6/18/2015 - added the PaperSource to P2P button so it uses what is selected in the UI and not the default tray by default.

Update: 6/24/2015 - Fixed up PaperSource to P2P button and POC so it uses what is selected in the UI and not the default tray by default.

Update: 8/24/2015 - fixed an issue with the P2P/POC selection on main form, it was not switching when selected.

Update: 11/30/2016 - Changed the margins to display in locale settings and not TWIPS. When changing the margins it converts them to TWIPs and sets the values

Update: 04/16/2018 - updated the margins to get the Conditional formatting formula value

Update: 04/16/2018 - Project is now using SP 21 or above ( 3500 ) assemblies.

Also, compiled both debug and release mode so it is not required to open in VS and build to update. You can find the exe's in this location: D:\CPP Net 2010\RAS2010_Printing\bin

 

 

Keywords

Crystal Reports, Crystal reports for Visual Studio, P2P, POC, PrintToPrinter, PrintOutputController, .NET, Winform Viewer , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio

Attachments

RAS2010_PrintingSP21.zip