I'm trying to embed/display a PDF in a WPF application. So far, I've tried those solutions, without success:
Display the PDF in a
WindowsFormsHost
hosting anAxAcroPdf
control, similarly to what's shown here. The problem is that my application setsAllowsTransparency = True
to create a style similar to Modern UI, but that doesn't blend well with aWindowsFormsHost
(the control becomes invisible).Display the PDF in a
WebBrowser
control. The problem is the same.Set
AllowsTransparency = False
, but this causes a sluggish feeling in the application. Since I use WPF purposedly to enhance the look and feel of our business applications to the benefit of our end-users, this can't be a solution.Use a second window with
AllowsTransparency = False
to display theWindowsFormsHost
, and hack it to make it look like a child control of the main window, as it's described here. However, I don't like the code-behind approach since I'm using MVVM.Find a native PDF control for WPF. However, I only found a couple of commercial ones and that's not an option right now.
What I need is to be able to:
- Display a PDF or its representation (i.e. an image or a conversion to another format) in a WPF application.
- Keep my style visually intact and fluid (
AllowsTransparency
must stayTrue
). - Use an approach respecting the principles of MVVM (preferably no code-behind).
- Include it in my application for free (for commercial usage).
I'm totally open to hand-made solutions, open-source libraries and even completely different approaches.