Developer Tools
|
Office Productivity Applications
|
Platform-Agnostic APIs
|
Home | Online Demos | Downloads | Buy Now | Support | About Us | News | Working Together | Contact Us
Gnostice PDFOne is a versatile PDF SDK for implementing PDF-related features in Java applications. PDFOne can create, edit, view, print, encrypt, decrypt, merge, split, reorganize, bookmark, annotate, watermark, and stamp PDF documents. PDFOne can also process PDF forms or AcroForms - create, edit, fill, and flatten form fields. The API hides the complexity of the PDF format and enables developers to quickly implement sophisticated PDF features. PDFOne is entirely self-contained and written in 100% Java code. It does not depend on external software such as Adobe PDF SDK, GhostScript or FreeType.
PDFOne is meant to work with Oracle Java 1.4 or later. Hence, we expect PDFOne-powered applications to work on Windows, Linux, Mac OSX, and Solaris. You can use PDFOne in popular Java IDEs such as Eclipse and NetBeans. You can view PDFOne API docs within your IDE. You can also deploy your PDFOne-powered applications using Ant.
PDFOne provides several components and classes for implemented PDF-related functions. The API is spread over several packages. To use PDFOne, you need to be familiar with only a few members of these packages.
Let us examine the main component classes to get a feel of the API.
// Create a new document object - This automatically creates // a blank new page if you do not load an existing document PdfDocument doc = new PdfDocument(); // Render some text on page 1 doc.writeText("Hello, world!", 100, 100); // Save document to file doc.save("sample_doc.pdf"); // Close I/O resources used for the document doc.close();Loading an existing document is also very easy.
// Create a new document object PdfDocument doc = new PdfDocument(); // Load an existing PDF document doc.load("sample_doc.pdf"); // Detect number of pages in the document System.out.println("samle_doc.pdf has " + doc.getPageCount() + " pages."); // Close I/O resources used for the document doc.close();The
PdfDocument
class provides methods
to add pages, text, images, shapes, headers, footers, tables, watermarks, annotations,
form fields, bookmarks, digital signatures, PDF actions and file attachments to
documents. It also has methods for specifying encryption, usage restrictions, and
viewer preferences. There are methods to reorganise PDF pages (merge, split,
extract, insert), export page content as text or image, parse page content, and
even search and redact text content.
// Create a printer object PdfPrinter prn = new PdfPrinter(); // Load a document prn.loadDocument("sample_doc.pdf"); // Get a list of printers String sPrinters[] = prn.getAvailablePrinterNames(); // If there are any printers if (sPrinters.length > 0) { // Select the first printer prn.setSelectedPrinterName(sPrinters[0]); // Print a print range for just once prn.print("1,3-4", 1); } // Close document prn.closeDocument();
PDFOne has several other helper classes representing various PDF features, document elements and implementation requirements. Let us check a few of them.
activate()
for activating your license key. To ensure that this method is called only once by your application, you
need to put this method in a static block.
static { PDFOne.activate("product key", "activation key"); }
PdfDocument
class. You can create an independent PDF page using an instance of this class, create content
using its methods, and add it to the current document.
// Create a new page PdfPage page2 = new PdfPage(PdfPageSize.A4); // Write some text on the new page page2.writeText("Hello again, world!", 100, 100); // Add the page to document doc.add(page2);Or, you can access a page of an existing document as a
PdfPage
instance.
// Obtain page #2 PdfPage page2 = doc.getPage(2); // Write text on page #2 page2.writeText("This text will be on page 2", 300.0, // x-coordinate 150.0); // y-coordinate
PdfFont
object, specify its properties, and pass it as an argument to one of the
text-rendering
methods. If you do not explicitly specify a font, PdfDocument
will choose
Arial or Helvetica. For specifying a different font, you neeed to create a
PdfFont
instance.
// Create a PdfDocument instance with the reader PdfDocument doc = new PdfDocument(r); // Create font objects PdfFont fontArialItalic = PdfFont.create("Arial", // name of installed font PdfFont.ITALIC | PdfFont.STROKE_AND_FILL, 18, PdfEncodings.WINANSI); PdfFont fontTahomaNormal = PdfFont.create("tahoma.ttf", // pathname of a font file PdfFont.STROKE_AND_FILL, 48, PdfEncodings.WINANSI); // Write text on page 1 using the Arial font created above doc.writeText("Hello again, World!", fontArialItalic, // font 100, 50); // Set font properties fontTahomaNormal.setStrokeWidth(2); fontTahomaNormal.setStrokeColor(Color.RED); fontTahomaNormal.setColor(Color.ORANGE); // Write more text on page 1 using Tahoma doc.writeText("Hello again, World!", fontTahomaNormal, // font 100, 100);
PdfAnnot
is an abstract class, you will need to use instances
of classes derived from it, such as PdfTextAnnot
,
PdfCaretAnnot
, PdfMarkupAnnot
, PdfWatermarkAnnot
and PdfInkAnnot
.
I guess by now you would have had a good feel of the PDFOne API. Now, let us go over the main features of PDFOne.
---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. |