cancel
Showing results for 
Search instead for 
Did you mean: 

programmatically changing the Paper Tray

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Oh, and here is the output of a utility i wrote that enumerates the printers trays.

former_member183750
Active Contributor
0 Kudos

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:

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow me on Twitter

Former Member
0 Kudos

Hi Ludek,

Yes that seems to have fixed the issue.

Thanks for your reply.

Gary

0 Kudos

Hi Gary,

There are new updates to CR for VS SP 14 that allows you to select the default Viewers print mode that you may want to look at also.

I wrote a sample app the requires SP 14 and also covers the trays  ENUM's and other info.

Have a look at this KBA:

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

Don

Answers (0)