Skip to main content

Document Viewer

  • 2 minutes to read

The XtraPrinting library includes a Print Preview that allows users to publish, customize, export, and print documents in Windows Forms applications. The Print Preview also contains tools that allow users to navigate within a document, zoom, scale, and modify its print and watermark settings.

document-viewer-ribbon

Add a Print Preview to a Form

  1. Drop the DocumentViewer control from the Toolbox onto the form.

    Drop the Document Viewer control from the Toolbox onto a form

  2. Create a toolbar. Refer to the following topic for instructions: Document Viewer Toolbars.

  3. Specify an object that supplies a document to the viewer. The viewer supports the XtraReport, Printing System, and Remote Document Source sources. Assign one of them to the viewer’s Document Source property.

    winforms-document-viewer-document-source

Enable DirectX Rendering

The GDI+ library is the default rendering engine for the Document Viewer control. If a viewer displays a document that contains many pages, this engine might render this document slowly. You can switch to the DirectX rendering engine to boost rendering performance. For this, enable the viewer’s UseDirectXPaint property. You can set the viewer’s EnableSmoothScrolling property to True to allow for more smooth page scrolling in DirectX mode. Note that smooth scrolling might require more application resources to render the pages.

The following limitations apply to the viewer when it uses DirectX rendering:

  • The Cached Report Source component is not supported.
  • The XRRichText control is rendered as an image. The default GDI+ library is used to render this control.
  • String sizes in a document might be greater compared with the case when the GDI+ library is used to render the document.