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.
PDFViewer control in WPF
Re: PDFViewer control in WPF
Support · May 17, 2021Hi,
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