如何合并多个pdf文件(在运行时生成)ItextSharp然后打印它们.
我找到了以下链接,但该方法需要pdf名称考虑到存储的pdf文件,这不是我的情况.
我有多个报告我会pdf files通过这种方法将它们转换为:
private void AddReportToResponse(LocalReport followsReport)
{
string mimeType;
string encoding;
string extension;
string[] streams = new string[100];
Warning[] warnings = new Warning[100];
byte[] pdfStream = followsReport.Render("PDF", "", out mimeType, out encoding, out extension, out streams, out warnings);
//Response.Clear();
//Response.ContentType = mimeType;
//Response.AddHeader("content-disposition", "attachment; filename=Application." + extension);
//Response.BinaryWrite(pdfStream);
//Response.End();
}
Run Code Online (Sandbox Code Playgroud)
现在我想将所有生成的文件(Bytes)合并到一个pdf文件中进行打印
我有一个RDLC文件,我想在其中创建一个表达式.这是表达式属性的图像.我需要连接First Name,Last name和Middle Init.

我是RDLC的新手所以请原谅我,如果我错过了一些明显的东西.
我有一些需要重复的数据,基于1:链接到主报表的数据集.它不能以表格形式显示,因为客户希望以特定方式布局,因此使用Tablix控件.我在这个主报告中有一些基于1:1数据集的子报告,一切都很酷.我为这个新数据集创建了一个子报告,并将其添加到主RDLC报告中.一切正常,但它只包括数据集的第一条记录.
是否可以为数据集中的每条记录重复此子报表?我认为令我困惑的是主要的RDLC没有专门加载各个子报告的代码,因此我没有看到任何可以包含循环或任何东西的地方.
我需要页码出现在报告的pdf导出中.我正在使用reportviewer 9.任何人都知道如何做到这一点?
谢谢,
艾萨克
我需要将我的日期列设置为2013年1月1日,在rdlc中执行此操作的格式是什么?
我给了
=CDate(Fields!IssuingDate.Value).ToString("dd-mmm-yyyy")
Run Code Online (Sandbox Code Playgroud)
它不能正常工作.任何人都发布了2013年7月2日的格式.
提前致谢.
在我的rdlc报告中,我想显示我的组数据就像这个例子 -
当我点击(+)标志组名称下的数据将展开,当我点击( - )时,名称下的组数据将崩溃.我找到了SSRS报告的资源,但最近没有对rdlc报告有用.所以我跟着在我的rdlc根据那些SSRC的报告资源,如果我能得到一些结果.我特意跟着这两个 -
我拿了一个table.take"GROUP2"作为行details.add组父"GROUP1"为"GROUP2".喜欢---
我选择"GROUP2"的组属性 -
然后我为"GROUP2"设置可见性隐藏,选中"显示可以通过此组项切换"并选择"GROUP1"作为item.like--
它给我这样的报告 -
"GROUP1"项目可见,"GROUP2"被隐藏,但没有(+)或( - )符号或按钮来展开或折叠组数据.
任何人都有任何想法,我错过了什么?或者如何在rdlc报告中执行此操作,如此问题的顶部示例,并且我还要为此报告设置"全部展开"和"全部折叠"按钮.
编辑:我使用的是asp.net mvc,web api-2 controller.我想以pdf格式获取报告.
我正在使用VS 2010的reportviewer控件来创建客户端报告(rdlc).在我的开发机器上一切正常,当我手动编译(通过VS2010)并手动部署到没有安装开发工具的测试机器时.
为了使测试机器能够正常工作(不安装VS2010或ReportViewer.exe),我必须在我的项目中添加对Microsoft.ReportViewer.Winforms,Microsoft.ReportViewer.Common和Microsoft.ReportViewer.ProcessingModel的引用并将它们全部"复制本地".
我有为Build Action配置的rdlc文件=>嵌入式资源.这是向项目添加新rdlc时的默认设置.我愿意配置这个,否则如果这会解决这个问题(不知道它是否相关).
问题:由于添加了rdlc文件,解决方案不再构建在构建服务器上.我在构建服务器上安装了ReportViewer.exe,并验证了GAC中是否存在所需的程序集..Net 4框架未安装在构建服务器上 - 我不认为这是必需的,因为该解决方案针对3.5运行时.
我相信问题的根源是构建日志中的以下内容:
目标"RunRdlCompiler":完全构建目标"RunRdlCompiler".输出文件"obj\Release\RdlCompile.compiled"不存在.使用程序集"Microsoft.ReportViewer.Common,Version = 9.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a"中的"RdlCompile"任务.任务"RdlCompile":Report\RDLC\GreenReport.rdlc(0,0):error rsInvalidReportDefinition:报告定义无效.详细信息:报表定义具有无效的目标命名空间" http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition ",无法升级.
据我所知,Microsoft.ReportViewer.Common版本10.0.0.0应该用于"编译"rdlc,但MSBuild似乎使用9.0.0.0.我相信如果我可以强制它使用正确的版本(安装在GAC中的IS),解决方案将编译.
我有一个应用程序,我必须打印RDLC报告,而不显示printDialog并使用应用程序中定义的默认指定的打印机.下面是我的测试实现代码.
Microsoft.Reporting.WinForms.ReportViewer reportViewerSales = new Microsoft.Reporting.WinForms.ReportViewer();
Microsoft.Reporting.WinForms.ReportDataSource reportDataSourceSales = new Microsoft.Reporting.WinForms.ReportDataSource();
reportViewerSales.Reset();
reportViewerSales.LocalReport.ReportPath = @"Sales.rdlc";
reportDataSourceSales.Name = "SalesTableDataSet";
int i = 1;
foreach (Product item in ProductSalesList)
{
dataset.CurrentSales.AddCurrentSalesRow(i, item.Name, item.Quantity.ToString(), item.Price.ToString(), item.Price.ToString());
i++;
}
reportDataSourceSales.Value = dataset.CurrentSales;
reportViewerSales.LocalReport.DataSources.Add(reportDataSourceSales);
dataset.EndInit();
reportViewerSales.RefreshReport();
reportViewerSales.RenderingComplete += new RenderingCompleteEventHandler(PrintSales);
Run Code Online (Sandbox Code Playgroud)
这是我的渲染完成方法
public void PrintSales(object sender, RenderingCompleteEventArgs e)
{
try
{
reportViewerSales.PrintDialog();
reportViewerSales.Clear();
reportViewerSales.LocalReport.ReleaseSandboxAppDomain();
}
catch (Exception ex)
{
}
}
Run Code Online (Sandbox Code Playgroud) 使用ASP.NET 4.0,我通过实例化a Microsoft.ReportingServices.RdlObjectModel.Report,设置Code属性并使用the返回流来创建RDLC流RdlSerializer.
然后我将该流传递给ReportViewer,如下所示:
ReportViewer1.LocalReport.LoadReportDefinition(rdlcStream);
Run Code Online (Sandbox Code Playgroud)
如果我没有设置Code属性,我没有收到任何错误,报告显示正确,但是当我Code为需要自定义代码的报告设置属性时,我得到了下面提到的'RequestMinimum' is obsolete错误.
编译表达式时发生意外错误.本机编译器返回值:'[BC40000]'RequestMinimum'已过时:'程序集级声明式安全性已过时,默认情况下不再由CLR强制执行.有关详细信息,请参阅http://go.microsoft.com/fwlink/?LinkID=155570.'.'.
在winforms应用程序中使用Report Viewer控件不会发生此错误.
有没有人见过/解决过这个问题?
如果.Net Core 2.0不支持Report Viewer,还有其他替代方法吗?
我找到了alanjuden的解决方案(https://alanjuden.com/2016/11/10/mvc-net-core-report-viewer/),但实际上是在寻找官方参考资料.
我们已将项目从.Net Framework 4.5.2迁移到.Net Core 2.0.但是,由于核心2.0不支持这些报告文件.
有什么建议?
提前致谢.
rdlc ×10
c# ×4
reportviewer ×3
asp.net ×2
dataset ×2
reporting ×2
field ×1
itextsharp ×1
msbuild ×1
pdf ×1
printing ×1
sql ×1
sql-server ×1