Developer Tools
|
Office Productivity Applications
|
Platform-Agnostic APIs
|
Home | Online Demos | Downloads | Buy Now | Support | About Us | News | Working Together | Contact Us
Last month, we released Version 2.00 of PDFOne Java. In this major update of our Java PDF library, we introduced two new components - PdfViewer and PdfPrinter. In this article, we will see how to create a Java PDF viewer application using NetBeans IDE. This application will your end-users to view PDF documents.
Here we go!
PdfDocument d;
try { // Read PDF document specified by the user // in the text field d = new PdfDocument(); d.load(txtFilePath.getText()); // Display the document in viewer viewer.loadDocument(d); setTitle(txtFilePath.getText() + " - Gnostice PDF Viewer"); } catch(PdfException pdfEx) { JOptionPane.showMessageDialog( this, pdfEx.getMessage(), "Gnostice PDF Viewer", JOptionPane.ERROR_MESSAGE); setTitle("Gnostice PDF Viewer"); } catch(IOException ioEx) { JOptionPane.showMessageDialog( this, ioEx.getMessage(), "Gnostice PDF Viewer", JOptionPane.ERROR_MESSAGE); setTitle("Gnostice PDF Viewer"); }
try { // Display first page of the document viewer.firstPage(); } catch(PdfException pdfe) { JOptionPane.showMessageDialog( this, pdfe.getMessage(), "Gnostice PDF Viewer", JOptionPane.ERROR_MESSAGE); } catch(IOException ioe) { JOptionPane.showMessageDialog( this, ioe.getMessage(), "Gnostice PDF Viewer", JOptionPane.ERROR_MESSAGE); }Add similar code for the actionPerformed events of btnPreviousPage, btnNextPage, and btnLastPage JButtons.
You can further improve the viewer 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-2025 Gnostice Information Technologies Private Limited. All rights reserved. |