我要用(Asp.net)水晶报表打印,需要打印的纸张不是A4纸,是专门打印发票的纸张,请问怎么设置打印机啊,程序应该怎么写呢? 我试过设置了打印机,可是不行。请高手赐教。
解决方案 »
- vs2008下发布网站时报错“behavior”不是已知的CSS属性名
- 更新数据库
- ASP.NET 2.0(c#)中RowFilter的用法(在线等)
- 请教,关于指定条件xml读取~
- 绝对路径与相对路径的问题?
- 关于frameset的问题!菜鸟问问题
- 插入新记录后怎么立即得到自动编号啊?
- 很久没有遇到这么棘手的问题了,关于从数据库读“二进制流”图片,绑定到DataGrid中的<img src="images?id=<% # Da......
- 有谁能详细介绍一下XMLHttp调用webservice实现不刷网页获取数据?
- dataview的问题
- 怎样怎样让字符串值自动加1??急啊,请高手指点:谢谢。
- 求一段用js实现图片预览的代码,谢谢
doc.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA4;
//设置报表方向为纵向
doc.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Portrait;//设置成 139.7 x 215.9 毫米的纸张,也就是“半刀纸”。
doc.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperStatement;
//设置报表方向为横向
doc.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
宽度 24.10cm
高度 14.00cm是不是 我搞错了 宽度 和高度了。
可是 还是 打印成A4了,怎么回事啊?请详细指教了,谢谢了。
1、用 IE 在客户端进行打印
2、导出后打印
3、直接在服务器上打印第一种情况,再加载报表后绑定前,编写以下代码CrystalDecisions.CrystalReports.Engine.ReportDocument doc = new ReportDocument();
doc.Load(Server.MapPath("../report/Chi.rpt"));
//设置成 139.7 x 215.9 毫米的纸张,也就是“半刀纸”,约 A4 的一半。
doc.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperStatement;
//设置报表方向为横向,注意系统没有真正的“半刀纸”,只有把上述纸张横着看才符合要求。打印时不需要设置为横打
doc.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
this.RptView.ReportSource=doc;
this.RptView.DataBind();绑定后在页面上就能看到半刀纸的效果,也就是 A4 纸的一半,通过 IE 打印即可第二种情况:在上述代码基础上,编写导出 pdf 文档代码string Fname=Server.MapPath("../../ExportFiles/"+Guid.NewGuid().ToString()+".pdf");
myDestinationFile.DiskFileName=Fname;
CrystalDecisions.Shared.DiskFileDestinationOptions myDestinationFile=new DiskFileDestinationOptions();
ExportOptions exportOpts = doc.ExportOptions;
exportOpts.DestinationOptions=myDestinationFile;
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat;
doc.Export();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.AppendHeader("Content-Disposition", "attachment; filename="+System.Web.HttpUtility.UrlEncode("Report.pdf",System.Text.Encoding.UTF8));
Response.WriteFile(Fname);
Response.Flush();
Response.Close();
File.Delete(Fname);第三种情况:由连在服务器上的打印机进行打印//设置打印机的名称,此处为服务器上拥有的网络打印机
doc.PrintOptions.PrinterName= @"\\192.168.0.10\HPLaserJ";
doc.PrintToPrinter(1,true,0,0);
DefaultPaperSize 打印机驱动程序中设置的默认大小。
Paper10x14 纸张大小为 254 x 355.6 毫米。
Paper11x17 纸张大小为 279.4 x 431.8 毫米。
PaperA3 A3 纸,297 x 420 毫米。
PaperA4 A4 纸,210 x 297 毫米。
PaperA4Small A4 小纸,210 x 297 毫米。
PaperA5 A5 纸,148 x 210 毫米。
PaperB4 B4 纸,250 x 354 毫米。
PaperB5 B5 纸,182 x 257 毫米。
PaperCsheet C 型纸,431.8 x 558.8 毫米。
PaperDsheet D 型纸,558.8 x 863.6 毫米。
PaperEnvelope10 #10 Envelope,104.8 x 241.3 毫米。
PaperEnvelope11 #11 Envelope,114.3 x 263.5 毫米。
PaperEnvelope12 #12 Envelope,120.7 x 279.4 毫米。
PaperEnvelope14 #14 Envelope,127 x 292.1 毫米。
PaperEnvelope9 #9 Envelope,98.4 x 225.4 毫米。
PaperEnvelopeB4 B4 Envelope,250 x 353 毫米。
PaperEnvelopeB5 B5 Envelope,176 x 250 毫米。
PaperEnvelopeB6 B6 Envelope,176 x 125 毫米。
PaperEnvelopeC3 C3 Envelope,324 x 458 毫米。
PaperEnvelopeC4 C4 Envelope, 114 x 229 毫米。
PaperEnvelopeC5 C5 Envelope,162 x 229 毫米。
PaperEnvelopeC6 C6 Envelope,114 x 162 毫米。
PaperEnvelopeC65 C65 Envelope,114 x 229 毫米。
PaperEnvelopeDL DL Envelope,110 x 220 毫米。
PaperEnvelopeItaly Italy Envelope,110 x 230 毫米。
PaperEnvelopeMonarch Monarch Envelope,98.4 x 190.5 毫米。
PaperEnvelopePersonal 6 3/4 Envelope,92.1 x 165.1 毫米。
PaperEsheet E 型纸,863.6 x 1117.6 毫米。
PaperExecutive Executive,184.1 x 266.7 毫米。
PaperFanfoldLegalGerman German Legal Fanfold,215.9 x 330.2 毫米。
PaperFanfoldStdGerman German Std Fanfold,215.9 x 304.8 毫米。
PaperFanfoldUS US Std Fanfold,377.8 x 279.4 毫米。
PaperFolio Folio,215.9 x 330.2 毫米。
PaperLedger Ledger,431.8 x 279.4 毫米。
PaperLegal Legal,215.9 x 355.6 毫米。
PaperLetter Letter,215.9 x 279.4 毫米。
PaperLetterSmall Letter Small,215.9 x 279.4 毫米。
PaperNote Note,215.9 x 279.4 毫米。
PaperQuarto Quarto,215 x 275 毫米。
PaperStatement Statement,139.7 x 215.9 毫米。
PaperTabloid Tabloid,279.4 x 431.8 毫米。
看看 吧