How can I add PDF View class to my windows form?


How can I drag & drop PDF viewer control to my windows form?
Alternatively what are the steps I need to take to add PDF View class
to my windows form?

To make PDFView class more versatile it is derived from Control
instead of UserControl (which is a derived from Control). Still adding
the control is quite easy. For a simplest example of using PDFView
class, please see 'PDFViewSample' sample project (http://

- First you will need to add a reference to PDFNet11.DLL.

To add PDFView control add the following lines to your WinForms file:

// Add the following lines to 'imports' section
using pdftron;
using pdftron.PDF;
using pdftron.Filters;
using pdftron.Common;

...public class MainForm : System.Windows.Forms.Form

// Add the following private variables in your forms class:
  private PDFView _pdfview;
  private PDFDoc _pdfdoc;

// Add the following initialization code in win form constructor:

public MainForm() {
  _pdfview = new PDFView();
  _pdfview.Location = new Point(0, 0);
  _pdfview.Dock = System.Windows.Forms.DockStyle.Fill;

// Add the following code to the main entry point for your application
static void Main() {
  // Make sure that 'pdfnet.res' from 'PDFNet/resources' is copied to
  // For more info, please see
  bool found = PDFNet.SetResourcesPath("c:/MyApp/pdfnet.res");
  if (!found) MessageBox.Show("PDFNet resource file 'pdfnet.res' was
     not found.\nSome files may not render properly.", "Error");

// Add the following method and use it to open PDF documents.
public bool OpenPDF(String filename) {
  try {
    _pdfdoc = new PDFDoc(filename);
    return true;
catch(PDFNetException ex) {
  catch(Exception ex) {
  return false;