Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[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]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
   [Collapse]Getting Started
     Lesson 1 - Creating a PDF Viewer
     Lesson 2 - Loading a Document
   [Expand]Interactive Forms
   [Expand]Navigation
   [Expand]Interactivity
    Deployment
   [Expand]Examples
   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]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Lesson 1 - Creating a PDF Viewer

This tutorial illustrates how to embed a PDF Viewer in a Windows Forms application, to open, preview, navigate and print PDF documents without the need to install third-party software on the machine.

The tutorial consists of the following sections.

Expanded Create an Application and Add a PDF Viewer

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

  2. Start a new project (by pressing CTRL+SHIFT+N), and create a new Windows Forms Application.

  3. Open the Visual Studio designer and press CTRL+ALT+X to run the Toolbox. Expand the DX.17.1: Common Controls category, and drop the PdfViewer control onto the main form of the application.

  4. Click the PDF Viewer's smart tag to invoke its actions list. In the actions list, click the Dock in parent container link. This allows the PDF Viewer to occupy all of the available space on the form.

  5. After docking the PDF Viewer, it will appear as follows.

Expanded Create and Customize a PDF Viewer Toolbar

To add a toolbar to the PDF Viewer, click the control's smart tag, and in the invoked actions list, select one of the following.

  • Create Ribbon

    This creates a ribbon illustrated in the following image.

    You can fully customize the ribbon afterwards, as well as select a different look and feel for it, via the smart tag of the toolbar.

  • Create Bars

    Instead of creating a ribbon, you can implement a bar interface. You can upgrade it to the ribbon interface at any time (e.g., when converting the entire application).

Expanded Load and Preview a PDF File

To load a document into the PDF Viewer, click the control's smart tag and select Load PDF file... in the actions list that is invoked.

To learn more about several ways of loading a document in the PDF Viewer, refer to the Lesson 2 - Loading a Document tutorial.

Note

The PDF Viewer shows bookmarks within its navigation pane for a document that contains them. So you can quickly locate and link to points of interest within a document. For more information, see the Bookmarks topic.

You can also see file attachments and thumbnails in the Attachments and Page Thumbnails panels on the navigation pane. For more information, see File Attachment, and Thumbnails topics.

Run the application and explore the PDF Viewer functionality.

Expanded See Also

How would you rate this topic?​​​​​​​