Displaying PDF Documents

Displaying PDF documents is a common task in modern applications. Differently from what happens with XPS documents (WPF offers the DocumentViewer control), PDFs have no native control, so you have a couple of alternatives: using the WebBrowser control and show the document inside the default viewer, or using an ActiveX control such as the one from Adobe Reader.

Displaying PDFs Using the WebBrowser Control

With the WebBrowser control, you can open any file and wait for the system to open the file inside the application that’s currently associated to that file extension. For instance, if you have Adobe Reader installed, launching a PDF with the WebBrowser starts Adobe Reader, pointing to the specified document.

This approach ...

Get Hidden WPF: Secrets for Creating Great Applications in Windows Presentation Foundation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.