Symptom
- Error: "The selected printer does not support collation" occurred when NumberOfCopies property is set to 2 or more
Environment
- SAP Crystal Reports 2008 V1
- Visual Studio 2008
- SAP Crystal Reports for Visual Studio 2010
- RAS SDK
Reproducing the Issue
The following VB.NET code is an example to get error when calling PrintOutputController.PrintReport method.
e.g.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RASPrint.Click
Dim pDoc As System.Drawing.Printing.PrintDocument
pDoc = New System.Drawing.Printing.PrintDocument
Dim rasPROpts As CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions
rasPROpts = New CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions
Dim PrintLayout As CrystalDecisions.Shared.PrintLayoutSettings
PrintLayout = New CrystalDecisions.Shared.PrintLayoutSettings
Dim rptClientDoc As CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument
Dim ds As New DataSet
reportDoc.Load("C:\test.RPT")
ds.ReadXml("C:\test.xml")
reportDoc.SetDataSource(ds)
rptClientDoc = reportDoc.ReportClientDocument
Dim papersize As System.Drawing.Printing.PaperSize = CType(cmbPaper.SelectedItem, System.Drawing.Printing.PaperSize)
Dim printername As String = cmbPrinter.Text
rasPROpts.PaperSize = papersize.RawKind
rasPROpts.PrinterName = printername ' e.g. "FUJITSU XL-9310_Pnavi2"
rasPROpts.JobTitle = reportDoc.FileName.ToString
rasPROpts.NumberOfCopies = 2 ' Set number of copies larger than equal 2
rptClientDoc.PrintOutputController.PrintReport(rasPROpts)
End Sub
Private Sub cmbPrinter_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbPrinter.SelectedIndexChanged
' Get a selected printer information
PrintDoc.PrinterSettings.PrinterName = CType(sender, ComboBox).Text
cmbPaper.Items.Clear()
' Get Paper Size information of selected printer
For Each ps As System.Drawing.Printing.PaperSize In PrintDoc.PrinterSettings.PaperSizes
cmbPaper.Items.Add(ps)
Next
cmbPaper.Text = CType(cmbPaper.Items(0), System.Drawing.Printing.PaperSize).PaperName
End Sub
Cause
The printer driver does not support the collation functionality.
The issue has been identified and logged under Problem Report ID ADAPT01651898.
Resolution
Workaround: If the printer driver does not support the collation functionality, the collation functionality sets "False" as default.
e.g.
PrintReportOptionsrasPROpts.PaperSize = papersize.RawKind
rasPROpts.PrinterName = printername
rasPROpts.JobTitle = reportDoc.FileName.ToString
rasPROpts.Collated = False ' Set False
rasPROpts.NumberOfCopies = 2 ' Set number of copies larger than equal 2
rptClientDoc.PrintOutputController.PrintReport(rasPROpts)
Keywords
rpt, PrintToPrinter, ReportPrint, collation, collated, PrintOutputController, PrintReportOptions, VB, Framework , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Bug Filed