1

In my silverlight I have the need to modify PDF files. I usually use Itext libraries for this kind of thing but I am seeing that I cannot reference .NET libraries in Silverlight. Is there any workaround to get the iText functions I need in Silverlight?

Jason Rowe
  • 6,216
  • 1
  • 33
  • 36
user313281
  • 13
  • 2

1 Answers1

1

Your question is a duplicate of this one, how can I use non-silverlight assemblies in silverlight.

As a work around I would suggest the following for using your itext library. Create a service to do your PDF file modification and then use it via WCF. First upload the PDF file to the server from the Silverlight application. Then call a method on the service using the uploaded path.

public void EditPdf(string pdfLocation)
{
    var document = new Document();
    PdfWriter.GetInstance(document, new FileStream(pdfLocation,FileMode.CreateNew));
    document.Open();
    document.Add(new Paragraph("Hello World"));
    document.Close();

}

Then retrieve the PDF for the user via the Silverlight client.

Community
  • 1
  • 1
Jason Rowe
  • 6,216
  • 1
  • 33
  • 36
  • Thanks Jason. This helps answer my question.. So I guess there is no way to edit the PDF file using exclusively Silverlight code so that the PDF file says on the local machine (iso-storage) instead of uploading to the server? – user313281 Apr 12 '10 at 21:44
  • As of Silverlight 3.0, you can only add Silverlight project references and Silverlight assemblies. So to use a non-silverlight assembly you would have to either create a Silverlight version or access the functionality via a service. – Jason Rowe Apr 12 '10 at 22:23
  • So in Silverlight 2.0 you could use outside libraries? Thanks! – user313281 Apr 12 '10 at 22:43
  • Take a look at this post. http://stackoverflow.com/questions/721375/how-can-i-use-non-silverlight-assemblies-in-a-silverlight-app – Jason Rowe Apr 12 '10 at 22:44