create a PDF document in Silverlight

84 Views Asked by At

I need to convert an excel file to save/display as a PDF document. This is in Silverlight Application. PDF document will be generated dynamically. The PDF document will contain plain text. I tried to download the nuget package.

The PDFSharp Library mentioned in one of the posts helped, How to create PDF on Silverlight 4

I had to look for an older version which is compatible with silverlight. My application is using .net framework 4. Would anyone know where I could find the dll for PDFSharp? I am unable to install using the 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

Error:

Install-Package : Could not install 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. For more information, contact the package author.

Thank you,

1

There are 1 best solutions below

0
I liked the old Stack Overflow On

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.

You have two options:

  • Use the NuGet package for Silverlight
  • Download the PDFsharp source code and reference the projects for Silverlight

The second approach can be helpful for debugging and allows you to change the Silverlight version compiled for.