PdfViewer Class
Displays PDF files in WinForms applications without the need to install any third-party software on end-user machines.
Namespace: DevExpress.XtraPdfViewer
Assembly: DevExpress.XtraPdfViewer.v18.1.dll
Declaration
[TypeConverter("DevExpress.XtraPdfViewer.Design.PdfViewerTypeConverter,DevExpress.XtraPdfViewer.v18.1.Design")]
[ToolboxTabName("DX.18.1: Common Controls")]
[ToolboxBitmap(typeof(ResFinder), "Bitmaps256.PdfViewer.bmp")]
public class PdfViewer :
XtraUserControl,
ICommandAwareControl<PdfViewerCommandId>,
IServiceContainer,
IServiceProvider,
IPdfViewer
Remarks
This control provides the user interface for end-users to open, view, navigate and print PDF documents.
For a design-time tutorial, see Lesson 1 - Creating a PDF Viewer.
Example
The following example illustrates how to load an existing PDF file into the PdfViewer control. To do this, it’s necessary to drop the PdfViewer control onto the form, create a Ribbon via the PdfViewer’s smart tag and call the PdfViewer.LoadDocument method.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-show-a-pdf-file-using-the-pdfviewer-control-e4696
using System;
using System.Windows.Forms;
namespace PdfViewerSample {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e) {
this.pdfViewer1.LoadDocument(@"..\..\Report.pdf");
}
}
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the PdfViewer class.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.