Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Displaying PDFs in Silverlight

I want to make a PDF document reader, and the only thing I've found to help me is "Amyuni PDF Suite" that will turn the PDF into XAML and stream that. Are there any other controls for displaying PDFs in Silverlight? Or could I add an IFrame into Silverlight and let the client render it?

Cheers

Nik

like image 431
niklassaers Avatar asked Mar 21 '09 22:03

niklassaers


2 Answers

Or could I add an IFrame into Silverlight and let the client render it?

Silverlight doesn't really have that capability. You can make your Silverlight control transparent, and have an HTML div block that sits above your Silverlight control, which you could then load a PDF in, but as for displaying a PDF within Silverlight, I think you're out of luck.

Edit: This question has some info on how to accomplish transparent Silverlight controls, I hope it helps!

like image 152
Rob Avatar answered Nov 11 '22 08:11

Rob


If you're ok with buying the pdf converter you can do something like this:

CanvasObject.Children.Add(XamlReader.Load("xaml string from pdf converter"));

And the pdf should be rendered inside your CanvasObject.

I really think you'll get the best result with some type of conversion to XAML. I imagine it can't be that hard to write the converter yourself, I might be wrong though.

like image 29
Oscar Kilhed Avatar answered Nov 11 '22 08:11

Oscar Kilhed