Developer Tools
|
Office Productivity Applications
|
Enterprise Solutions
|
|||||||||||||||||||||||







IMPORTANT NOTE
With the release of Version 2.0, the code and the steps for creating a PDF viewer has changed. Please read the article How To Create A PDF Viewer in PDFOne .NET v2.x for updated information.
With absolutely no ado, here are the steps.
Form1 to your liking.toolStrip1 in the code snippets below) from the toolbox and add the following controls in the listed order on the strip:
tb_Filename)First Page, Previous Page, Next Page, and Last Page.Form1 to go to Code View. Extend the Form1 class by
PDFDocument and PDFViewer, and
public partial class Form1 : Form
{
// New private members
PDFDocument doc1;
PDFViewer viewer1;
public Form1()
{
InitializeComponent();
// Initialize the private members
doc1 = new PDFDocument();
viewer1 = new PDFViewer();
}
if (tb_Filename.Text == "")
{
return;
}
// Close previous document if any
if (doc1.GetPageCount() > 0)
{
doc1.Close();
doc1.Dispose();
}
// Load PDF document
try
{
doc1.Load(tb_Filename.Text);
}
catch(Exception err1)
{
MessageBox.Show(
"Sorry. There has been an error. Error Information: "
+ err1.Message);
return;
}
// Add viewer to Form1
this.Controls.Add(viewer1);
// Position the viewer just below the toolstrip
viewer1.Location = new System.Drawing.Point(
this.toolStrip1.Location.X,
this.toolStrip1.Location.Y
+ this.toolStrip1.Height + 1);
// Display document in viewer
viewer1.Document = doc1;
// Adjust viewer dimensions
viewer1.Height = this.Height - 30;
viewer1.Width = this.Width - 10;
// Update form title bar
this.Text = "PDF Viewer - " + tb_Filename.Text;
viewer1.NextPage();Add similar code similar for click events of the labels First Page, Previous Page, and Last page.
You can further improve the code by adding support for
Downloads:
---o0O0o---
| Our Developer Tools | |
|---|---|
eDocEngine VCLA Delphi/C++Builder component suite for creating documents in over 20 formats and also export reports from popular Delphi reporting tools. |
PDFtoolkit VCLA Delphi/C++Builder component suite to edit, enhance, view, print, merge, split, encrypt, annotate, and bookmark PDF documents. |
XtremePDFConverter VCLA Delphi/C++Builder component to intelligently convert PDF to user-friendly Word RTF documents. |
|
PDFOne .NETA .NET PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, and bookmark PDF documents in .NET applications. |
XtremeDocumentStudio .NETMulti-format document-processing component suite for .NET developers |
PDFOne (for Java™)A Java™ PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, bookmark PDF documents in Java™ applications. |
XtremeFontEngine (for Java)Java font engine to render glyphs from Type 1, Type 2 (CFF), and TrueType fonts |
| Our Office Productivity Applications |
|---|
Free PDF ReaderA free, fast, and portable application for viewing, printing and converting PDF documents. |
| Privacy | Legal | Feedback | Newsletter | Resellers | © 2002-2013 Gnostice Information Technologies Private Limited. All rights reserved. |
This site is best viewed on a screen with minimum resolution of 1152 x 864 pixels. Windows XP users are advised to use Microsoft ClearType Tuning for optimal experience. Also, please use the latest version of a standards-compliant browser such as Firefox, Opera, or Dragon (Chromium).