Hank
Hank

Reputation: 8477

View PdfSharp document in a WPF control

I'm using the companion MigraDoc and PdfSharp libraries to generate a report.

The PdfSharp documentation repeatedly refers to WPF and talks about you can "draw on a PDF page as well as in a window", but I can't figure out how to view my PdfDocument in a viewer. All of the examples just kick the rendering off to another program by opening the documents with Process.Start().

Do either of these libraries include WPF controls for viewing the documents? Ideally I'm looking for a basic document viewer control, similar to the built-in RichTextEditor viewer for FlowDocuments.

(I'm using the PdfSharp and MigraDoc libraries that are distributed through NuGet.)

Upvotes: 1

Views: 14113

Answers (2)

Dester
Dester

Reputation: 31

You can use WPF PDF Viewer. It wraps the Adobe PDF Reader COM Component as a WPF control

Upvotes: 3

abhishek
abhishek

Reputation: 2992

PDF Viewer is an ActiveX control which needed to be hosted using WindowsFormHost. If you need a WPF renderer for PDR, Adobe didnt introduced it yet. You need to create it yourself and parse the PDF document.

Here are few links which will help you how to host a PDF document on your WPF window :

http://www.codeproject.com/Articles/380019/Using-Adobe-Reader-in-a-WPF-app

http://hugeonion.com/2009/04/06/displaying-a-pdf-file-within-a-wpf-application/

Telerik has a PDF Viewer created using WPF which does the rendering of a PDF document using WPF. Its called RADPDFViewer http://blogs.telerik.com/blogs/posts/12-02-29/introducing-pdf-viewer-for-silverlight-wpf.aspx

You have to either use one that is shipped by Adobe or you need to create it of your own just like Telerik did.

Upvotes: 2

Related Questions