on 11-05-2023 10:32 AM
Hi Folks,
I am having difficulty in getting the printouts to come from the desired tray in my WinFOrmas App using an OKI B721 Laser printer.
The form has radio buttons for selecting the desired tray. But regardless of the tray I select, the print out ALWAYS comes comes out of the same tray.
Here is my code:
// Get Report
ReportDocument rep = new ReportDocument();
rep.Load("cheque.rpt");
// Create Printer Settings object
System.Drawing.Printing.PrinterSettings printerSettings = new System.Drawing.Printing.PrinterSettings();
printerSettings.PrinterName = "OKILaser";
// Set Printer Tray
if (rdoAuto.Checked)
rep.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Auto;
else if (rdoCassette.Checked)
rep.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Cassette;
else if (rdoEnvelope.Checked)
rep.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Envelope;
else if (rdoEnvelopeManual.Checked)
rep.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.EnvManual;
else if (rdoFormSource.Checked)
rep.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.FormSource;
else if (rdoLargeCapacity.Checked)
rep.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.LargeCapacity;
else if (rdoLargeFMT.Checked)
rep.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.LargeFmt;
else if (rdoLower.Checked)
rep.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Lower;
else if (rdoManual.Checked)
rep.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Manual;
else if (rdoMiddle.Checked)
rep.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Middle;
else if (rdoSmallFMT.Checked)
rep.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.SmallFmt;
else if (rdoTractor.Checked)
rep.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Tractor;
else if (rdoUpper.Checked)
rep.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Upper;
// Send to Printer
rep.PrintToPrinter(printerSettings, new System.Drawing.Printing.PageSettings(), false);
Hello again,
I think I have found the solution.
I needed to define the PageSettings Object rather than creating a new instance like so...
System.Drawing.Printing.PageSettings ps = new System.Drawing.Printing.PageSettings();
ps.PaperSource = new System.Drawing.Printing.PaperSource() { RawKind = (int)CrystalDecisions.Shared.PaperSource.Upper };
// Send to Printer
rep.PrintToPrinter(printerSettings, ps, false);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.