4,817
社区成员
发帖
与我相关
我的任务
分享
crReportDocument.PrintOptions.PaperSize = PaperSize.PaperEnvelopeC5;
crReportDocument.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
但是打印出來地依舊是橫向地
設置紙張PaperEnvelopeC5的時候位置錯誤
設置紙張PaperEnvelopeC65 的時候,預覽正確,但是打印出來顯示空白。
打印是,因爲橫向放置信封太長,只能把封口處向下,縱向打印?
應如何設置?
環境: Vs2005 ,自帶水晶報表
現在出現問題:設置紙張類型PaperSize.PaperEnvelopeC65;
此時輸出爲pdf,
DiskFileDestinationOptions df = new DiskFileDestinationOptions();
df.DiskFileName = Server.MapPath(".") + "\\" + Session.SessionID.ToString().Trim() + ".pdf";
crReportDocument.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
crReportDocument.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;
crReportDocument.ExportOptions.DestinationOptions = df;
crReportDocument.Export();
//output to browser
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.WriteFile(df.DiskFileName);
Response.Flush();
Response.Close();
輸出pdf後點擊打印,打印出來內容空白,用A4紙打印也是空白
但是,如果先把pdf保存到硬盤上,然後再打開pdf文件進行打印,則打印正常
這是什麽原因導致
ReportDocument crReportDocument = new ReportDocument();
crReportDocument.PrintOptions.PaperSize = PaperSize.PaperEnvelopeC65;
crReportDocument.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
crReportDocument.Load(Server.MapPath("EnvLop.rpt"));
crReportDocument.FileName = Server.MapPath("EnvLop.rpt");
crReportDocument.SetDataSource(ds.Tables[0]);
DiskFileDestinationOptions df = new DiskFileDestinationOptions();
df.DiskFileName = Server.MapPath(".") + "\\" + Session.SessionID.ToString().Trim() + ".pdf";
crReportDocument.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
crReportDocument.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;
crReportDocument.ExportOptions.DestinationOptions = df;
crReportDocument.Export();
crReportDocument.Close();
crReportDocument.Dispose();
//output to browser
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.WriteFile(df.DiskFileName);
Response.Flush();
Response.Close();
try
{
//delete temp file
System.IO.File.Delete(df.DiskFileName);
}
catch (Exception ex)
{
}