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.
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 LoadDocument method.
C#:Form1.cs |
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");
}
}
}
|
VB:Form1.vb |
Imports System
Imports System.Windows.Forms
Namespace PdfViewerSample
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
Me.pdfViewer1.LoadDocument("..\..\Report.pdf")
End Sub
End Class
End Namespace
|
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.Control
System.Windows.Forms.ScrollableControl
System.Windows.Forms.ContainerControl
System.Windows.Forms.UserControl
XtraUserControl
PdfViewer