Developer Tools
|
Office Productivity Applications
|
Platform-Agnostic APIs
|
Home | Online Demos | Downloads | Buy Now | Support | About Us | News | Working Together | Contact Us
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
, andpublic 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 .NET Developer Tools | |
---|---|
Gnostice Document Studio .NETMulti-format document-processing component suite for .NET developers. |
PDFOne .NETA .NET PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, and bookmark PDF documents in .NET applications. |
Our Delphi/C++Builder developer tools | |
---|---|
Gnostice Document Studio DelphiMulti-format document-processing component suite for Delphi/C++Builder developers, covering both VCL and FireMonkey platforms. |
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. |
Our Java developer tools | |
---|---|
Gnostice Document Studio JavaMulti-format document-processing component suite for Java developers. |
PDFOne (for Java)A Java PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, bookmark PDF documents in Java applications. |
Our Platform-Agnostic Cloud and On-Premises APIs | |
---|---|
StarDocsCloud-hosted and On-Premises REST-based document-processing and document-viewing APIs |
Privacy | Legal | Feedback | Newsletter | Blog | Resellers | © 2002-2024 Gnostice Information Technologies Private Limited. All rights reserved. |