/pclbox

Java library for parsing PCL printer data streams

Primary LanguageJavaApache License 2.0Apache-2.0

pclbox Build Status codecov.io Coverity Status Download

Java library for parsing PCL printer data streams. The library supports PCL up to version 5 as well as PJL and HP-GL/2. PCL version 6 (aka PCL-XL) is currently not supported.

Note that the support of HP-GL/2 is somehow limited. pclbox requires that the HP-GL/2 commands are terminated by a semicolon, which is not required by the specification (the specification requires that only the last command is terminated by a semicolon).

Dependencies

pclbox has no runtime dependencies on other libraries. This was a design decision and will (hopefully) never change.

Usage

Because pclbox is available at jcenter it is very easy to use pclbox in your projects. At first, add pclbox to your build file. If you use Maven, add the following to your build file:

<dependency>
  <groupId>de.textmode.pclbox</groupId>
  <artifactId>pclbox</artifactId>
  <version>1.0</version>
  <type>pom</type>
</dependency>

If you use Gradle, add this:

dependencies {
    compile 'de.textmode.pclbox:pclbox:1.0'
}

In your Java code you need to create a PrinterCommandHandler and pass this, together with a File or InputStream, to the constructor of the PclParser. Then invoke the method parse of the PclParser. This will parse the complete PCL data stream.

For every parsed command, the method handlePrinterCommand of the PrinterCommandHandler gets invoked. This method receives a PrinterCommand that can be passed to an own implementation of the PrinterCommandVisitor.

Contribute

If you want to contribute to pclbox, you're welcome. But please make sure that your changes keep the quality of pclbox at least at it's current level. So please make sure that your contributions comply with the pclbox coding conventions (formatting etc.) and that your contributions are validated by JUnit tests.

It is easy to check this - just build the source with gradle before creating a pull request. The gradle default tasks will run checkstyle, findbugs and build the JavaDoc. If everything goes well, you're welcome to create a pull request.

Hint: If you use Eclipse as your IDE, you can simply run gradle eclipse to create the Eclipse project files. Furthermore you can import Eclipse formatter settings (see file config/eclipse-formatter.xml) as well as Eclipse preferences (see file config/eclipse-preferences.epf) that will assist you in formatting the pclbox source code according the used coding conventions (no tabs, UTF-8 encoding, indent by 4 spaces, no line longer than 120 characters, etc.).

Manuals

The following reference materials were used to implement this parser: