Developer Tools
|
Office Productivity Applications
|
Platform-Agnostic APIs
|
Home | Online Demos | Downloads | Buy Now | Support | About Us | News | Working Together | Contact Us
Eclipse and NetBeans are popular and powerful IDEs for developing Java programs. In a previous article, we had shown how to create a Java PDF viewer in NetBeans IDE. In this article, we will take you step-by-step in running a PDFOne Java program.
Start Eclipse IDE. Eclipse will display a Workspace Launcher dialog box and ask you to choose a workspace folder. Select a folder or type the pathname of a folder where the workspace needs to be created or is already present.
If the workspace does not already exist, Eclipse will then create the workspace and then display a Welcome screen.
From the Eclipse IDE menu, create a new project by selecting File » New » Java Project.
Eclipse will then display a New Java Project wizard. In this wizard, type a name for the project in the Project name text box and click the Finish button.
To create a new Java program in your project, right-click your project in Package Explorer and select New » Class in the context menu. Eclipse will then display a New Java Class dialog.
Type a name for the class in the Name text box. Type a name for the package where the class needs to be created in the Package text box. Select the Which method stubs would you like to create? » public static void main(String[] args) check box and click Finish.
Eclipse will then create a package with the name you have specified under your project in Project Explorer. In the code editor view, your class will be displayed with a main method stub.
To use PDFOne Java in this class, you need to first place PDFOne Java jar file in the build path of your project. For this, right-click your project and select Build Path » Configure Build Path on the context menu.
In this dialog, click on the Libraries tab.
In this tab, click on Add External JARs... button. Eclipse will then display a JAR Selection dialog.
In this dialog, navigate to the directory where you have extracted the contents of the PDFOne Java download file, find the PDFOne.jar file in the bin directory, select it, and click on the Open button on the JAR Selection dialog. Eclipse will then add PDFOne Java JAR file to the list of JARs and class folder in the build path on the Libraries tab.
To test your project settings, place the following code snippet inside the main method.
try { PdfDocument doc = new PdfDocument(); doc.writeText("Gnostice PDFOne Java", 10, 10); doc.setOpenAfterSave(true); // Only for Windows doc.save("SamplePDF.pdf"); doc.close(); System.out.println( "SamplePDF.pdf has been created successfully"); } catch(Exception e) { System.out.println("Could not create PDF"); System.out.println(e.getMessage()); }
To run this program, select Run » Run As » Java Application. The Java program will then start executing.
If the program runs successfully, Eclipse will capture the console output message "SamplePDF.pdf has been created successfully" and display it in the Console view. In Windows, the Java program will also try to display the SamplePDF.pdf document in its default viewer application.
---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. |