Giter Club home page Giter Club logo

jipp's Introduction

CircleCI CodeCov Maven Central Dokka Kotlin ktlint

JIPP: A Java-compatible IPP library

This project contains:

  • jipp-core, the core IPP parser/builder for IPP packets.
  • jipp-pdls, which converts raster format docs to common page description languages (PCLm and PWG-Raster).
  • jprint, a sample app showing how jipp-core can be used to send a document to a printer.

jipp-core features:

  • Supports construction of IPP servers, clients, routers, gateways, etc.
  • Common operations and attributes are defined and ready to use.
  • Can be extended to support new operations and attributes.
  • Can be used over any transport (typically HTTP).
  • Includes a pretty-printer for human-readable IPP packet display.
  • Kotlin users can access a type-safe packet building DSL

What could I do with this?

  • Scan and show available printers on your network to your users.
  • Implement an Android Print Service.
  • Test IPP clients or IPP printers in interesting ways.
  • Experiment with alternative IPP transports.
  • Implement a cloud-based print server or client.

The API is fully Java-compatible but is actually implemented in Kotlin. JavaDoc is available for the Java-facing API.

Usage

In short:

  1. Add the current version of JIPP to your project
dependencies {
    compile 'com.hp.jipp:jipp-core:0.6.1'
    compile 'com.hp.jipp:jipp-pdl:0.6.1' // Only needed if transforming PDLs
}
  1. Create an IppClientTransport or IppServerTransport (see example HttpIppClientTransport.java)
  2. Use the transport to send and receive IppPacket objects, e.g.:
URI uri = URI.create("http://192.168.1.100:631/ipp/print");
IppPacket printRequest = new IppPacket(Operation.printJob, 123,
        groupOf(operationAttributes,
                attributesCharset.of("utf-8"),
                attributesNaturalLanguage.of("en"),
                printerUri.of(uri),
                requestingUserName.of("user"),
                documentFormat.of("application/octet-stream")));
transport.sendData(uri, new IppPacketData(printRequest, new FileInputStream(inputFile)));

A very basic use case is demonstrated by the jprint sample app. To run it:

# build the app
./gradlew jprint:build

# unzip in the current directory
unzip -o ./sample/jprint/build/distributions/jprint-*.zip

# Use IPP to print a file to the supplied HTTP/IPP endpoint.
# (The printer must natively support the file type.)
jprint-*/bin/jprint "ipp://192.168.1.102:631/ipp/print" sample.pdf

API Maturity

Until 1.0, APIs may still be changed in non-backwards-compatible ways.

Migration from v0.5.7 to v0.6.*

0.6 includes some API changes. Some changes may require changes in your code.

  • Types now includes all defined types as published as of 2018-04-06 at IANA.
  • Collection types such as MediaCol are now expressed as POJO objects and are automatically constructed/deconstructed.
  • com.hp.jipp.model.IppPacket moved to com.hp.jipp.encoding.IppPacket so that all PWG generated code lives in .model.
  • Keyword attribute values now present as simple, untyped Strings. Allowed strings are provided in static objects (e.g. Media.java defines all possible media types.)
  • The MediaSize type is removed in favor of Media strings. If needed, the MediaSizes utility class provides a method to extract x- and y-dimensions from a Media keyword containing dimensions.
  • The Attribute class is now a List of attribute values, so it is no longer necessary to call .getValues() to obtain them.
  • The AttributeGroup class is now a List of Attribute<*> so it may be iterated directly to access attributes it contains.
  • Attributes of Name or Text types now appear in those types to allow clients to access language information if present and to distinguish from ordinary keywords. The following additional methods may help to convert attribute values to String:
    • Name.asString() and Text.asString() are Stringable and extract the value in string form. .getValue() also does this.
    • Attribute.strings(), AttributeGroup.getStrings(), and IppPacket.getStrings() do the same for all types.
  • Status.ok is now Status.successfulOk, etc.

Dependencies

jipp-core's only dependencies are JDK 6+ and the current Kotlin runtime.

Building

./gradlew build

A full build of this project requires python (2.x) and dot to generate dependency graphs

Related projects

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.