XDoc.PDF
Features
Tech Specs
How-to C#
How-to VB.NET
Pricing
Guide for C#
Core Document Formats
Windows Forms Viewer
Additional Features

C# PDF - Create Windows PDF Viewer in C#.NET

C#.NET PDF Document Viewing Control SDK for .NET Windows Forms Project

Visual C#
Home > .NET Imaging SDK > C# > Create PDF Windows Viewer

"This online guide content is Out Dated!
    Please get the latest Create PDF Windows Viewer Developer Guide here.
"

C# PDF Document Windows Viewer - Overview
RasterEdge PDF Document Viewer SDK for .NET Windows Forms is designed to display, manipulate and print PDF document in a Windows Forms application by C# programming code. Using this C#.NET Windows Forms PDF document viewer library SDK, you can easily load PDF document from local files or steams and view it in created document viewer.
After loading the target PDF document file, you are also allowed to navigate to any page of source PDF document file, highlight & mark PDF document with rich annotation objects, zoom PDF document page, view PDF file in different display formats, and save source PDF file using C# code within a .NET Windows Forms application. This PDF document viewer control SDK for C#.NET Windows Forms application can be delivered as an independent toolkit, which can perform fully-featured PDF document viewing and manipulating without using other external third-party software.
On this page, besides brief introduction to RasterEdge C#.NET PDF document viewer & reader for Windows Forms application, you can also see the following aspects.
  • Feature list for PDF document viewer control in C#.NET Windows Forms application
  • Advanced APIs for C#.NET WinForms PDF viewing application
  • Step-by-step guidance on how to create C#.NET Windows Forms PDF document viewer
C# WinForms PDF Viewer Control Features
  • 100% managed C#.NET component with fast PDF document viewing functionality
  • Pure native Windows Forms control without any dependency on Adobe products
  • Add PDF viewing and manipulating capacities to C#.NET Windows Forms application
  • Able to display and view PDF document from both local files and byte streams using C#.NET
  • Support navigating, zooming, annotating and saving PDF in C# WinForms project programmatically
  • Offer cost-effective developer and server licenses for application development and distribution
C# WinFroms PDF Viewing APIs
  • LoadFromFile(String filePath): Accept the path of PDF file that you want to open in document viewer.
  • SaveFile(String filePath): Save PDF document file to a specified path in C# WinForms application.
  • UpPage: Scroll to previous visible page in the currently open PDF document.
  • DownPage: Scroll to next visible page in the currently open PDF document.
  • ZoomIn: Increase current zoom percentage of C#.NET WinViewer.
  • ZoomOut: Decrease current zoom percentage of C#.NET WinViewer.
  • FitWidth, FitHeight, ShowOneToOne: Reset size of the currently displayed PDF document page.
  • AddPage: Prior to the currently displayed PDF page to add a blank page.
  • DeletePage: Delete the currently displayed PDF page.
  • Roate90: Rotate the currently displayed PDF page 90 degrees clockwise.
  • Rotate180: Rotate the currently displayed PDF page 180 degrees clockwise.
  • Rotate270: Rotate the currently displayed PDF page 90 degrees counterclockwise.
  • DrawText, DrawFreehand, DrawLine, DrawPolygonLines, DrawFilledRectangle, DrawRectangle, DrawHighLight, DrawEllipse, DrawPolygon, DrawRubberStamp: Draw the specified type annotation on PDF page in C#.NET Windows Viewer.
  • BurnAnnotation: Burn all annotations to PDF page.
  • DeleteAnnotation: Delete all selected annotations.
Create Windows PDF Viewer in C#
In this section, we offer detailed guidance for you to create and add a PDF document viewer & reader in Windows Forms application using C# code. What should be noted here is that the following C# Windows Forms project test is running in Visual Studio 2005. Besides, please make sure you have installed .NET Framework 2.0 or above versions before using this C# Windows Forms PDF document viewer control.

Set up a Visual C# WinForms Project

  1. The first step is to create a C#.NET Windows Forms project with the name of WinViewerDemo. If you still have one, omit this step;
  2. Next is to add RasterEdge.Imaging.WinformsControl.DocumentViewer.dll control to your Visual C#.NET project. Right-click on the "Toolbox", select "Choose Items...", and browse to locate and select "RasterEdge.Imaging.WinformsControl.DocumentViewer.dll";
  3. Then, you will see .NET WinViewer DLL Control in VS Toolbox.

Open a PDF Document in C#.NET WinForms Viewer

  1. After adding WinViewer DLL into Visual Studio Toolbox, you can directly drag and drop the control on your C#.NET WinForms application form (Here, we take a blank form as an example);
  2. Now, with simple C#.NET code, you can easily open a file dialog and load your PDF document in WinViewer control (see sample code below);
  3. Please note that, there will be a pop-up window "cannot open your file" if your loaded file is not supported by our .NET WinForms Document Viewer Control.
If you want to try more functions (design Thumbnail, Navigation, Zoom and so on), please refer to Create Windows Viewer Guide.
public void Form1()
{
	InitializeComponent();
	// Set the windows viewer display options.
	ViewerOptions option = new ViewerOptions();
	// Set the windows viewer height and width. This step is necessary, otherwise will crash.
	option.DocViewerWidth = 400;
	option.DocViewerHeight = 400;
	// Show the thumbnail, true or false.
	option.ShowThumb = true;
	// The location of thumbnail, left, right, top or bottom.
	option.ThumbDock = ThumbDock.Left;
	// Set the thumbnail height
	option.ThumbViewerHeight = 1000;
	// Set whether the document viewer is spread as winViewer
	option.SizeByDocViewer = false;
	// Create windows viewer form.
	winViewer = new WinViewer(option);
	winViewer.Height = 800;
	winViewer.Width = 1000;
	// Add the windows viewer to your own form.
	this.panel1.Controls.Add(winViewer);
}
private void OpenFile_Click(object sender, EventArgse)
{
	OpenFileDialog ofd = new OpenFileDialog();
	ofd.Filter = "(*.*)|*.*";
	ofd.Multiselect = false;
	if (ofd.ShowDialog() == DialogResult.OK)
	{
		this.winViewer1.LoadFromFile(ofd.FileName);
	}
}

Draw an Annotation on PDF Page in C#.NET WinForms Viewer

  1. It is easy to draw and add an annotation on PDF file page in C#.NET Windows Forms Viewer by directly call a single method for your desired annotation that you want to support in your toolbar button's Onclick events. Please see Visual C# demo code below.
  2. Moreover, C# programmers are able to resize, burn, delete and move created PDF annotation in WinForms Viewer control. Of course, it's necessary for you to add some buttons to complete these operations. In general, there's option to burn or delete PDF annotation when right-clicking on the created PDF annotation. If you right-click on the thumbnail, there is the option to "Add new page" or "delete page".
private void HighLight_Click(object sender, EventArgse)
{
this.winViewer1.DrawHighLight();
}

private void Text_Click(object sender, EventArgse)
{
this.winViewer1.DrawText();
}
If you want to use this Windows Forms PDF document viewer control in VB.NET class application, you can view the tutorial page for VB.NET Windows Forms PDF Viewer Control. Besides, RasterEdge DocImage SDK for .NET also offers the toolkit to create PDF document viewer & reader in ASP.NET web application using C# code.
Related C# PDF Imaging Project Tutorials!
Please click the following link to see more C# PDF imaging project tutorials.


Recommend this to Google+

RasterEdge.com is professional provider of document, content and imaging solutions, available for ASP.NET AJAX, Silverlight, Windows Forms as well as WPF. We are dedicated to provide powerful & profession imaging controls, PDF document, image to pdf files and components for capturing, viewing, processing, converting, compressing and stroing images, documents and more.

©2000-2016 Raster Edge.com