PDFViewer control in WPF

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Viewer for .NET (v3)  /  PDFViewer control in WPF

DynamicPDF Viewer for .NET (v3) Forum

 May 17 2021 11:38 AM
I am using WindowsFormsHost to host PDFViewer control in my WPF application.  Below is in my xaml and xaml.cs:

<WindowsFormsHost Name="PdfImage" Grid.Row="1" Visibility="Collapsed" ></WindowsFormsHost>


PdfDocument pdf = img.GetPdfDocument();
ceTe.DynamicPDF.Viewer.PdfViewer pdfViewer = new ceTe.DynamicPDF.Viewer.PdfViewer();
pdfViewer.ZoomMode = Zoom.FitPage;
PdfImage.Child = pdfViewer;
PdfImage.Width = this.Width;
PdfImage.Height = this.Height;
pdfViewer.Width = (int)PdfImage.Width;
pdfViewer.Height = (int)PdfImage.Height;
pdfViewer.Open(pdf);


I have the following UI issues:

1. The PDF image doesn't fit the in the available space even thought I set the ZoomMode to ZoomFitPage
2. When I minimize the Windows, the PDF Viewer shrinks to a smaller image.

Please suggest.

 May 17 2021 5:40 PM
Posted by a ceTe Software moderator
Hi,

1. We tested this on our end and are able to view the PDF with a specified zoom in the Windows form host.

2. This looks like expected behavior. You may want to add an event to the WidowsFormHost to change the viewer control's dimensions to see if that works for you.

Thanks,
ceTe Software Support Team

All times are US Eastern Standard time. The time now is 3:03 PM.