Articles in this section

How to host WPF PDF Viewer in windows forms?

WinForms PDF viewer does not support adding or editing the annotations in PDF documents. As a workaround, the PDF viewer WPF control can be hosted in WF application that supports text markup and shape annotations in the PDF document. Refer to the following code sample.

C#

// Declare the ElementHost variable
        ElementHost elementHost = null;
   // Wire up the Load event
            this.Load += new System.EventHandler(this.Form1_Load);
 
private void Form1_Load(object sender, System.EventArgs e)
        {
            // Create the ElementHost control
            elementHost = new ElementHost();
            elementHost.AutoSize = true;
            elementHost.Size = panel1.Size;
            elementHost.Dock = DockStyle.Fill;
            panel1.Controls.Add(elementHost);
 
            PdfViewer wordEditor = new PdfViewer();
            elementHost.Child = wordEditor;
 
            elementHost.Margin = new Padding(0, 0, 0, 0);
            elementHost.Region = new Region();
            elementHost.BackColor = System.Drawing.Color.White;
        }

Find the sample for your reference from the following link:



Note:

Starting with v16.2.0.x, if you reference Syncfusion® assemblies from the trial setup or the NuGet feed, include a license key in your projects. Refer to the link to learn about generating and registering the Syncfusion® license key in your application to use the components without a trial message.

 

Conclusion:

I hope you enjoyed learning about how to host WPF PDF Viewer in windows forms.

 

You can refer to our Flutter PDF feature tour page to learn about its other groundbreaking features and documentation, and how to quickly get started with configuration specifications. You can also explore our Flutter PDF Flutter PDF examples to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to explore our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied