Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

programmatically changing the Paper Tray

Hi,

I have an HP LaserJet Enterprise M605n with 6 trays. I am trying to print a report to a specific paper tray.

I used the following code, without success. can somebody help me out?

Dim printerSettings As Printing.PrinterSettings = New Printing.PrinterSettings

printerSettings.PrinterName = "\\sshmdc\Job Manager Printer"

Dim pagSett As Printing.PageSettings = New Printing.PageSettings(printerSettings)

Dim rptClientDoc As CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument = m_report.ReportClientDocument

Dim rasPROpts As CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions = New CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions()

Dim iBins As Integer = pagSett.PrinterSettings.PaperSources.Count

If iBins > 1 Then

rasPROpts.BinName = "Tray 2"

End If

rasPROpts.PrinterName = pagSett.PrinterSettings.PrinterName.ToString()

rasPROpts.JobTitle = "Reporting"

rptClientDoc.PrintOutputController.PrintReport(rasPROpts)

pagSett = Nothing

rasPROpts = Nothing

I am using SAP Crystal Reports Runtime engine for .NET Framework (32 bit) 13.0.13.1597

and SAP Crystal Reports, version for Microsoft Visual Studio 13.0.12.1494

Former Member
replied

Hi Gary

Please see if the following KBA and sample app attached to the KBA will help:

1217207 - How to switch printer trays when using Crystal Reports 10 in VS .NET application

You should also update your install to SP14:

SAP Crystal Reports, developer version for Microsoft Visual Studio: Updates & Runtime Downloads

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow me on Twitter

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question