I AM Using a Label Printer in order to print a Label but the report is always printing portrait no matter what i do below is the code i use
Code: Select all
StiReport Rep = new StiReport();
SqlConnection connection = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ToString());
DataSet dss = new DataSet();
SqlDataAdapter sqlAdp = new SqlDataAdapter();
System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand();
command.Connection = connection;
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "SP_DosePrint";
command.Parameters.AddWithValue("TransHdrID", Convert.ToInt32(THID));
connection.Open();
sqlAdp.SelectCommand = command;
sqlAdp.Fill(dss);
connection.Close();
var reports = from r in hmsDB.Reports where r.EngName == "Dose Print1" select r.StiReport;
var result = reports.SingleOrDefault().ToString();
Rep.LoadFromString(result);
StiOptions.Print.UsePrinterSettingsEntirely = true;
string printername = System.Configuration.ConfigurationManager.AppSettings["LabelPrinter"].ToString();
PrinterSettings PrinterSetting = new PrinterSettings();
PrinterSetting.PrinterName = printername;
Rep.RegData(dss);
Rep.Compile();
Rep.Render();
Rep.Print(false, PrinterSetting);
Please help