简体   繁体   English

在 Silverlight 中创建 PDF 文档

[英]create a PDF document in Silverlight

I need to convert an excel file to save/display as a PDF document.我需要转换 excel 文件以保存/显示为 PDF 文档。 This is in Silverlight Application.这是在 Silverlight 应用程序中。 PDF document will be generated dynamically. PDF 文档将动态生成。 The PDF document will contain plain text. PDF 文档将包含纯文本。 I tried to download the nuget package.我尝试下载 nuget package。

The PDFSharp Library mentioned in one of the posts helped, How to create PDF on Silverlight 4其中一篇文章中提到的 PDFSharp 库有所帮助, How to create PDF on Silverlight 4

I had to look for an older version which is compatible with silverlight.我不得不寻找与 silverlight 兼容的旧版本。 My application is using .net framework 4. Would anyone know where I could find the dll for PDFSharp?我的应用程序正在使用 .net 框架 4. 有人知道我在哪里可以找到 PDFSharp 的 dll 吗? I am unable to install using the nuget package.我无法使用 nuget package 进行安装。

Message: Add reference problem in silverlight: You can't add a reference to dll as it was not built against the silverlight runtime消息:在 silverlight 中添加引用问题:您无法添加对 dll 的引用,因为它不是针对 silverlight 运行时构建的

Error:错误:

Install-Package: Could not install package 'PDFsharp-sl 1.50.4000-beta3b'.安装包:无法安装 package 'PDFsharp-sl 1.50.4000-beta3b'。 You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', but the package does not contain any assembly references or content files that are compatible with that framework.您正在尝试将此 package 安装到以“.NETFramework,Version=v4.0”为目标的项目中,但 package 不包含任何与该框架兼容的程序集引用或内容文件。 For more information, contact the package author.如需更多信息,请联系 package 作者。

Thank you,谢谢,

It looks as if you took the Silverlight version of the library, but attempted to add it to a project that does not compile against Silverlight.看起来好像您使用了库的 Silverlight 版本,但试图将其添加到不针对 Silverlight 编译的项目中。

You have two options:你有两个选择:

  • Use the NuGet package for Silverlight将 NuGet package 用于 Silverlight
  • Download the PDFsharp source code and reference the projects for Silverlight下载 PDFsharp 源代码并参考 Silverlight 的项目

The second approach can be helpful for debugging and allows you to change the Silverlight version compiled for.第二种方法有助于调试,并允许您更改为其编译的 Silverlight 版本。

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

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