wpf-9697-controls-and-libraries-printing-exporting-concepts-document-preview.md
This topic describes the DocumentPreviewControl that is used to display an interactive document preview in WPF applications.
The topic consists of the following sections:
The Document Preview displays document data provided by a document source of one of the following supported document source types:
When a document is created, it is displayed in the Document Preview.
You can display a document in a Document Preview as follows:
Call the corresponding method of the PrintHelper class or create a DocumentPreviewWindow instance. Note that only the default Document Preview is displayed.
Add the DocumentPreviewControl to your application and associate it with the required document.
Refer to the following section for more information: Document Preview.
The Document Preview can include a toolbar and menu that contain buttons used to view, navigate, edit, print and export a document. The control supports the following toolbar types:
Each toolbar button triggers a specific command. For example, clicking the Page Setup… button triggers the DocumentPreviewControl.PageSetupCommand and invokes the Page Setup dialog, which is illustrated in the following image:
Use the CommandBarStyle property to specify the toolbar type.
If a document contains bookmarks, the Document Map panel becomes available and allows you to quickly navigate through the document.
If a report has visible parameters, a corresponding button that toggles the visibility of the Parameters panel appears. The Parameters panel UI allows you to modify parameter values and regenerates the document accordingly.
The Thumbnails toolbar button changes the visibility of report thumbnails used to quickly navigate between document pages.
To search for specific text throughout a document, click the Search toolbar button to invoke the dedicated Search panel.
If content editing is enabled for document elements, you can customize the corresponding field values in the Document Preview (clicking a field will invoke a corresponding editor). To highlight all editable fields available in a document, click the Editing Fields toolbar button.
You can add drill-down functionality to a report to display data partially. Users can click the Show Details / Hide Details element to access the hidden detail data.
You can add interactivity to reports displayed in a Document Preview using the following Print Preview mouse events (for example, to create drill-through reports or enable data sorting directly in the preview):
Refer to the following example for more information: How to create a drill-through report in WPF.
To learn how to customize the Document Preview, refer to the following tutorials:
See Also