Fork me on GitHub

High level API

Since version 0.4.0, Ghost4J provides a high level API, to make document handling easier with Ghostscript.

The high level API is composed of the following items:

  • Documents: A document is an object representing a document (usually a Postscript or PDF file). It provides methods to load, write and count pages on the document itself.

  • Components: Components are processing units feed with documents. Families of components are: Analyzer, Converter, Modifier and Renderer. Not all types of documents are necessarily supported by components.

Documents

Documents are represented by the org.ghost4j.document.Document interface.

Available implementations are:

ClassDescription
org.ghost4j.document.PSDocumentHandle Postscript document
org.ghost4j.document.PDFDocumentHandle PDF document

Analyzers

Analyzers are components used to extract data of any kind out of a document. They are represented by the org.ghost4j.analyzer.Analyzer interface.

Available implementations are:

ClassDescriptionSupports PostscriptSupports PDF
org.ghost4j.analyzer.FontAnalyzerExtract font information: font names and embedding statusNoYes
org.ghost4j.analyzer.InkAnalyzerExtract ink coverage information for each page in % as CMYK componentsYesYes

Converters

Converters are components used to convert documents to a given file format. They are represented by the org.ghost4j.converter.Converter interface.

Available implementations are:

ClassDescriptionSupports PostscriptSupports PDF
org.ghost4j.converter.PSConverterConvert a document to a Postscript fileYesYes
org.ghost4j.converter.PDFConverterConvert a document to a PDF fileYesYes

Modifiers

Modifiers are components used to modify documents. They are represented by the org.ghost4j.modifier.Modifier interface.

ClassDescriptionSupports PostscriptSupports PDF
org.ghost4j.modifier.SafeAppenderModifierAppend a document to another. Document types can be mixedYesYes

Renderers

Renderers are components used to render document pages to image files. They are represented byt he org.ghost4j.renderer.Renderer interface.

Available implementations are:

ClassDescriptionSupports PostscriptSupports PDF
org.ghost4j.renderer.SimpleRendererRender a range of pages from a document to imagesYesYes