public void printShow() { FJprintMoble newmoban = new FJprintMoble(); //物品姓名 TextObject GoodsName = (TextObject)newmoban.ReportDefinition.ReportObjects["GoodsName"]; GoodsName.Text = infoOne.DrugName; //物品重量 TextObject GoodsWeight = (TextObject)newmoban.ReportDefinition.ReportObjects["GoodsWeight"]; GoodsWeight.Text = infoOne.DrugWeight.ToString() + "市斤"; //分拣序号条形码 TextObject FJ_idM = (TextObject)newmoban.ReportDefinition.ReportObjects["FJ_idM"]; //FJ_idM.Font = new Font("code 128", 20); FJ_idM.Text = "*" + "2016080614592031" + "*"; //分拣序号 TextObject FJ_id = (TextObject)newmoban.ReportDefinition.ReportObjects["FJ_id"]; FJ_id.Text = infoOne.FJ_id; System.Drawing.Printing.PrintDocument doc = new System.Drawing.Printing.PrintDocument(); int rawKind = 1; for (int i = 0; i <= doc.PrinterSettings.PaperSizes.Count - 1; i++) { if (doc.PrinterSettings.PaperSizes[i].PaperName == "称重标签") { rawKind = doc.PrinterSettings.PaperSizes[i].RawKind; } } newmoban.PrintOptions.PrinterName = doc.PrinterSettings.PrinterName; newmoban.PrintOptions.PaperSize = (CrystalDecisions.Shared.PaperSize)rawKind; // 设置打印纸张样式 newmoban.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.DefaultPaperOrientation; //默认纸张方向 newmoban.PrintToPrinter(1, false, 1, 1); return; }