简体   繁体   English

.NET中的Crystal Report to PDF

[英]Crystal Report to PDF in .NET

I put together a POC console app. 我整理了一个POC控制台应用程序。 to generate a PDF from a Crystal Report (using CrystalDecisions libraries) 从Crystal报表生成PDF(使用CrystalDecisions库)

It all works fine on my dev. 一切对我的开发人员都有效。 box, but encounters an exception when executed elsewhere: 框,但在其他位置执行时遇到异常:

Could not load file or assembly 'CrystalDecisions.ReportAppServer.CommLay er, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or on e of its dependencies. 无法加载文件或程序集“ CrystalDecisions.ReportAppServer.CommLay er,版本= 13.0.2000.0,Culture = neutral,PublicKeyToken = 692fbea5521e1304”或其依赖项。 The system cannot find the file specified. 该系统找不到指定的文件。

Unhandled Exception: System.TypeInitializationException: The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception. 未处理的异常:System.TypeInitializationException:'CrystalDecisions.CrystalReports.Engine.ReportDocument'的类型初始化程序引发了异常。 -- -> System.IO.FileNotFoundException: Could not load file or assembly 'CrystalDeci sions.ReportAppServer.CommLayer, Version=13.0.2000.0, Culture=neutral, PublicKey Token=692fbea5521e1304' or one of its dependencies. --> System.IO.FileNotFoundException:无法加载文件或程序集“ CrystalDeci sions.ReportAppServer.CommLayer,版本= 13.0.2000.0,Culture = neutral,PublicKey Token = 692fbea5521e1304”或其依赖项之一。 The system cannot find the f ile specified. 该系统找不到指定的文件。 at CrystalDecisions.CrystalReports.Engine.ReportDocument..cctor() 在CrystalDecisions.CrystalReports.Engine.ReportDocument..cctor()

I believe this is caused by the absence of the Crystal Reports runtime (which is not explicitly installed). 我认为这是由于缺少Crystal Reports运行时(未明确安装)引起的。

1) Can anyone please confirm this? 1)有人可以确认吗?

2) Is there any way to get this working without installing Crystal Reports runtime on the target machine(s)? 2)是否有任何方法可以在目标计算机上不安装Crystal Reports运行时的情况下完成此工作?

I've read about building an installer with merge modules etc. but this is a console app and I don't want to go down that route. 我读过有关使用合并模块等构建安装程序的信息,但这是一个控制台应用程序,我不想走这条路。

Thanks in advance. 提前致谢。

EDIT: 编辑:

I checked out the DLL dependencies and this actually appears to be missing libraries API-MS-WIN-CORE-* 我签出了DLL依赖关系,实际上似乎缺少库API-MS-WIN-CORE- *

You will need to distribute the runtime for Crystal Reports to work. 您将需要分发运行时,Crystal Reports才能正常工作。

Another option is to write second app to generate the pdf files which you could install on a server, then each of your console apps send a request to the new server app which sends back the pdf. 另一个选择是编写第二个应用程序以生成可安装在服务器上的pdf文件,然后每个控制台应用程序向新服务器应用程序发送一个请求,该请求将回传pdf文件。 This would mean the crystal runtime would only be installed on one machine, and the original console app wouldn't need to worry about it. 这意味着将仅将Crystal运行时安装在一台计算机上,而原始控制台应用程序则无需担心。

Just for information, the crystal runtime can be downloaded from here: http://scn.sap.com/docs/DOC-7824 仅作为参考,可以从此处下载Crystal运行时: http : //scn.sap.com/docs/DOC-7824

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM