Dominic Jonas
Dominic Jonas

Reputation: 5025

WPF: Show PdfPage without Adobe/WebBrowser with native c#/wpf

I want to show PdfPages without any adobe or 3rd party application like the WebBrowser (which is an activeX control).

Based on the following example I have made a little PdfViewer where I can easily show PdfPages:

The strategy behind this example is to render each page into an image and show it directly with a ContentPresenter.


Now I my problem is the bad quality: There is some blurry effect.

Also setting RenderOptions.SetBitmapScalingMode(image, BitmapScalingMode.HighQuality); does not solve the problem.

Adobe Reader enter image description here enter image description here

My Solution enter image description here enter image description here

Upvotes: 0

Views: 512

Answers (1)

Breeze Liu - MSFT
Breeze Liu - MSFT

Reputation: 3808

As the Windows.Data.Pdf Namespace introduction, it is for converting a page in a Portable Document Format (PDF) document to an image file. The PDF will be blurred if it is not on the corresponding size.

In UWP, PDF APIs support high fidelity rendering, but only for C++ applications using Direct2D. You can refer this PDF viewer showcase sample to learn how to use it. But it seems you are creating a WPF app, you can have a try.

Note that: This is a Windows 8.1 app, VS2017 can not be used to open it, you can use VS 2013 or VS2015 and the API is similar as UWP apps.

Upvotes: 1

Related Questions