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?
+1
A:
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.
Jason Rowe
2010-04-10 02:02:41
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?
2010-04-12 21:44: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
2010-04-12 22:23:33
So in Silverlight 2.0 you could use outside libraries? Thanks!
2010-04-12 22:43:32
Take a look at this post. http://stackoverflow.com/questions/721375/how-can-i-use-non-silverlight-assemblies-in-a-silverlight-app
Jason Rowe
2010-04-12 22:44:44