SAP Knowledge Base Article - Public

1386475 - How to set printer name and print job title at runtime using Report Application Server SDK for Visual Studio .NET

Symptom

How to set printer name and print job title at runtime using Report Application Server (RAS) SDK for Visual Studio .NET

Environment

  • Crystal Reports 2008 V0
  • Crystal Reports 2008 V1
  • Microsoft Visual Studio 2005
  • Microsoft Visual Studio 2008

Resolution

Use CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions class to set the printer name and print job title.

Visual Basic .NET sample code:

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.ReportAppServer.ClientDoc
Imports CrystalDecisions.ReportAppServer.Controllers


Dim crReportDocument As New ReportDocument
Dim boReportClientDocument As ISCDReportClientDocument
Dim boPrintOutputController As PrintOutputController
Dim boPrintReportOptions As New PrintReportOptions

' load the report
crReportDocument.Load("C:\CrystalReports\Report1.rpt")

boReportClientDocument = crReportDocument.ReportClientDocument
boPrintOutputController = boReportClientDocument.PrintOutputController

' set printer name
boPrintReportOptions.PrinterName = "Canon LBP-740"
' set print job title
boPrintReportOptions.JobTitle = "Crystal Report"

' print the report
boPrintOutputController.PrintReport(boPrintReportOptions)

crReportDocument.Close()
crReportDocument.Dispose()

 

 

 

Keywords

RAS.NET, CR for .NET, dotNET, VB.NET, VS.NET, CR2008 , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To

Product

Crystal Reports 2008 V0 ; Crystal Reports 2008 V1