A newer version of this page is available. Switch to the current version.

How to: Add a Print Preview to a Windows Forms Application

  • 2 minutes to read

This document describes the steps required to provide a Windows Forms Application with print preview capability, to display printable documents from different sources.

To create a print preview, do the following.

  1. Run Visual Studio 2012, 2013, 2015, 2017 or 2019, and create a new Windows Forms Application.
  2. To add a print preview to your application, switch to the application’s main form in Visual Studio, and press CTRL+ALT+X to open the Toolbox. Next, drag the DocumentViewer control from the DX.19.1: Reporting category and drop it onto the form.

    HowTo - ShowPreviewOnForm2.png

  3. Click the smart tag of the control, and in the invoked actions list, select a toolbar that matches the user interface style of your application. In this tutorial, the Ribbon toolbar is used.


  4. To assign a document source to the Document Viewer, click its smart tag again and in the drop-down menu of the DocumentViewer.DocumentSource property, select the option that meets your requirements.


    To learn how to assign different document sources, proceed with the following topics:

The following image illustrates a Document Viewer with no document source assigned to it.


See Also