【发布时间】:2016-01-04 05:19:01
【问题描述】:
我正在尝试从用 C# 编写的网络表单应用程序打印 SSRS 报告。报告已加载到报告查看器中,到目前为止,这是我的代码:
protected void printAll(object sender, EventArgs e)
{
//loads report into reportviewer
showReport("/SHOW_ALL");
string mimeType;
string encoding;
string extension;
string[] streams;
Warning[] warnings;
byte[] pdfBytes = ReportViewer.ServerReport.Render("IMAGE", string.Empty, out mimeType,
out encoding, out extension, out streams, out warnings);
string outputPath = "C://Temp/";
string outputFile = Path.GetFileName(ReportViewer.ServerReport.ReportPath) + "_" + client.FullName + ".tiff";
string fullOutput = outputPath + outputFile;
if (File.Exists(fullOutput))
{
File.Delete(fullOutput);
}
using (FileStream fs = new FileStream(fullOutput, FileMode.Create))
{
fs.Write(pdfBytes, 0, pdfBytes.Length);
fs.Close();
}
}
我只是想将图像写入 iFrame 并打印出来。我尝试过作为 PDF 格式,但 IE 不呈现任何内容(没有内置的 pdf 查看器),如果我使用 .tiff 选项,则除了第一页之外无法打印任何内容。我浏览了许多与 winforms 或各种其他技术相关的文章,但到目前为止没有任何帮助。跨浏览器的东西会很好,但目前我只是在寻找更适合 IE 的东西。
【问题讨论】:
标签: c# asp.net reporting-services webforms