[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Collapse]PDF Viewer
   [Expand]Getting Started
    Coordinate Systems
   [Expand]Navigation
   [Expand]Access and Edit Document Content
   [Expand]Interactivity
    Deployment
   [Collapse]Examples
    [Collapse]Getting Started
      How to: Add a PDF Viewer to the WinForms Application at Design Time
      How to: Add a PDF Viewer to the WinForms Application via Code
      How to: Load a PDF Document from a File
      How to: Load a PDF Document from a Stream
    [Expand]Interactive Form
    [Expand]Text Markup Annotations
    [Expand]Interactivity
    [Expand]Customization
    [Expand]Printing
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Add a PDF Viewer to the WinForms Application via Code

This example describes how to programmatically add a PDF Viewer to a Windows Forms application.

To add a PDF Viewer to the Windows Forms application at runtime, do the following.

  1. Run Microsoft® Visual Studio® 2010, 2012, 2013, 2015 or 2017.

  2. Create a new Windows Forms application project or open an existing one.

  3. Open the Solution Explorer, right-click References and choose Add Reference... to add references to the PDF Viewer libraries.

  4. In the Extensions tab, select the DevExpress.XtraPdfViewer.v18.1, DevExpress.Pdf.v18.1.Core, DevExpress.Data.v18.1, DevExpress.Utils.v18.1 assemblies and click OK.

  5. Write the following (or similar) code:

  6. Run the application to see the result.

Expanded See Also

Is this topic helpful?​​​​​​​