PDF Viewer for WPF application

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Viewer for .NET (v1)  /  PDF Viewer for WPF application

DynamicPDF Viewer for .NET (v1) Forum

 Sep 25 2014 7:08 AM
I am working on a WPF application and having a requirement in which I need to display the PDF document which is returned as byte[] from DB. And for the security concern I also don't have to save it on the client workstation.

For this purpose, I have used PDFViewer. It suffice all these requirements.
But I am facing following UI related issues with PDFViewer control in WPF:

1) If I initially change (decrease) the zoom percent, the PDF page doesn't fit well in the available sapce. However, it get shifted to the right border and keep unused space on the left border.

2) If I try to minimize the size by using resizing handle from the bottom, then it start repainting the whole window and the application hangs during this process.

I am using WindowsFormsHost to host PDFViewer control in my applicatio and followed the same steps as mentioned in one of your post.Please suggest.
 Sep 25 2014 12:22 PM
Posted by a ceTe Software moderator

You are seeing this behavior most likely because of the size set to the hosting control and Viewer in the main window. Please try setting the width and height of the main window  to the WindowsFormsHost and the Viewer dynamically and see if it works for you. Below is the code sample for it.

       private void Window_Loaded(object sender, RoutedEventArgs e)
            PdfViewer viewerObj = new PdfViewer();
            PdfDocument pdf = new PdfDocument("DocumentB.pdf");
            windowsFormsHost1.Child = viewerObj;
            windowsFormsHost1.Width = this.Width;
            windowsFormsHost1.Height = this.Height;
            viewerObj.Width = (int)windowsFormsHost1.Width;
            viewerObj.Height = (int)windowsFormsHost1.Height;

If you continue getting the similar behavior then please send over the following details to support@cete.com so that we can look into it further.

1.Sample project which uses static data using which we can recreate the behavior.
2.Steps to recreate the behavior.

ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 5:11 PM.