Hewlett-Packard Appliance Printing Development Kit

# Hewlett-Packard Appliance Printing Software Development Kit

#

# Introduction

#

#

#

#

#

Version | Date | Comments
2.0.0 | 10.02.00 | Second Release

Notice

The information contained in this document is subject to change without notice.

Hewlett-Packard makes no warranty of any kind with regard to this material, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. Hewlett-Packard shall not be liable for errors contained herein or for incidental or consequential damages in connection with the furnishing, performance, or use of this material.

All SDK documentation included in this list, received with the Hewlett-Packard Appliance Printing Software Development Kit, or received at a later date as a result of communication with any Hewlett-Packard employee regarding the Hewlett-Packard Appliance Printing Software Development Kit, is Hewlett-Packard "confidential" information.

Licensee shall not export or re-export the Hewlett-Packard documentation, or copies or variations thereof. Licensee may use Hewlett-Packard documentation only to develop Licensee Printer Drivers for exclusive use only on Hewlett-Packard printers.

Licensee shall assure that all Hewlett-Packard Software and all documentation based on Hewlett-Packard Documentation include the following notice:

"Copyright © [year]

Hewlett-Packard Company.

All Rights Reserved."

Hewlett-Packard Documentation has been developed entirely at private expense and is provided as "Commercial Computer Software" or "restricted computer software." Use, duplication or disclosure by the US Government or a US Government subcontractor is subject to the restrictions set forth in subparagraph (c) (1) (ii) of the Rights in Technical Data and Computer Software clauses in DFARS 252.227-7013 or as set forth in subparagraph (c) (1) and (2) of the Commercial Computer Software-Restricted Rights clauses in FAR 52.227-19, as applicable. The Contractor is Hewlett-Packard Company, 3000 Hanover Street, Palo Alto, California 94304.

Copyright ã 2000

Hewlett-Packard Company.

All rights reserved.

#

# Introduction

Welcome to the Hewlett-Packard Appliance Printing Software Development Kit (SDK). This kit contains everything you need to begin developing a Hewlett-Packard DeskJet printer driver for your host system. The SDK is comprised of documentation, sample test and HTML help files, tools to aid the developer in integrating and testing their printer driver, and most importantly, driver source code written in C++.

The SDK contains code that, although not a printer driver by itself, will be the basis for creating a very small yet functional printer driver. This code contains space-optimized versions of many of the same core imaging technologies used in full-featured Hewlett-Packard Windows drivers, as well as basic print mode support and built-in printer text support. Most of the recent DeskJet models are supported by this version of the SDK. Future versions will provide additional support for new DeskJet models and potentially other Hewlett-Packard products as well.

The SDK does not assume that developers have any direct knowledge of printer drivers; It does assume that programmers have a working knowledge of C and C++ , including the principles and vocabulary of object oriented design. The developer must be familiar with all aspects of their own host system, which is needed to render and format data in a manner suitable for the printed page.

Hyperlinks have been inserted throughout the documentation to create shortcuts. Hyperlinks are indicated with blue, underlined text.

> Overview of the SDK

> SDK Design Objectives

> Limitations

> Minimum Host System Requirements

> SDK Table of Contents

[Back to top]

## Overview of the SDK

The SDK final product is designed to accept pre-formatted, 24-bit sRGB raster data and/or ASCII text, convert it to a high-quality, printer-ready data stream, and send it to an Hewlett-Packard DeskJet printer via a host-implemented I/O mechanism. The SDK also helps to provide the necessary structure and controls for a given print job, and enables the system (through an API) to perform various printer maintenance activities, (e.g. cleaning the pens).

The SDK is primarily responsible for converting device-independent data into a device-dependent, printer-optimized stream of bytes. Because the conversion process for color inkjet printers is quite complicated, it is important to not change device-independent portions of the SDK code. The color science involved is relatively complex and requires a thorough understanding of Hewlett-Packard’s inkjet technology.

The SDK code also interprets status information from the printer and relays it to the system for presentation to the user. Note that the SDK code itself does not attempt to notify or directly interact with the user. Instead user interfaces for initiating or configuring a print job and visual presentation of printing status information are left to creation by the developer. This provides flexibility for the operating systems to maintain a consistent look and feel. Ultimately, this should help insulate developers from most of the details encountered with printing, and instead allow them to focus on other areas.

The developer must realize that the creation of a printer driver is only one piece of the entire printing solution. If the target platform already has existing print architecture, the effort to create and integrate the new driver may be minimal. However, if there is no pre-existing print functionality, or if the functionality is substantially different from what the SDK assumes about the host environments, then additional work will be required.

Additional efforts might include modifying the application software on the target platform to support printing, or adding necessary infrastructure support for optional background printing or spooling. Other documents within this kit will discuss some of these options in greater detail and guide the developer towards a more complete printing solution to satisfy the end customer.

[Back to top]

## SDK Design Objectives

This SDK has been developed primarily to meet the demand for Hewlett-Packard DeskJet connectivity in the non-PC markets. Due to the varying nature and diversity of devices that have or might desire printing capabilities, the SDK core code has been created with several key objectives:

> - Small driver size - to meet the needs of small memory footprint devices.

> - Portability – to enable quick deployment on all kinds of devices.

> - Extensibility – to allow for future enhancements.

> - Features & Performance – to provide the proper balance of print quality, speed and feature support, given the current size and portability constraints.

Many of these supported features are implemented in such a way that they are both modular and optional. If a given device will not use an available feature, it is okay to be left out. However, the developer is strongly encouraged to communicate the level of support (features, performance, etc.) offered, with their customers. (For example, developers should state for their customers that banners and duplex printing are not supported, regardless of the fact that the printers have the functional capability.) This should be made clear on any appropriate Web pages, on-line help pages, in manuals, etc., in order to help the user establish the proper expectations before purchasing a printer for a specific device or environment, or trying to print in an unsupported manner.

## Limitations

In order to achieve each of the SDK design objectives (small driver size, portability, etc.,) the finished printer driver will not, and can not be as full featured as Hewlett-Packard’s corresponding Windows driver. Size and portability are the main restrictions that limit the features provided in this kind of driver. For a complete list of features supported by printer model, refer to the Printing document's Printers and Features Supported table.

[Back to top]

## Minimum Host System Requirements

The minimum host system requirements necessary to operate a printer driver fall into the following basic categories:

Development Requirements:

- C++ Compiler. (Developers can create the appropriate binary printer driver by using compilers and tools of their own choosing (such as GNU, etc.))

Physical Connectivity:

- The only physical connectivity requirement is a supported I/O port on the device (USB, parallel/IEEE-1284, etc.).

CPU Bandwidth:

- CPU Bandwidth needs depend on the type of printing support required as well as what other operations are occurring in the system at print time.

For graphics support:

- A 100 MHz Pentium class processor.

For simple, ASCII-only text support:

- A low-end processor.

### Available Memory:

- Code & static tables (50 – 120K).

- Run-time buffer space (25 – 60K, possibly 120K for high-res 6 color).

Code size and run-time RAM usage depend on several variables including the compiler, the printer type selected, the level of print functionality required (such as the optional ASCII text support or image scaling module), and the type and number of DeskJet models supported. As with anything else, compiled code size is also dependent on the targeted processor type.

Be sure to leave extra room for future driver growth as well, in order to support new printer models and/or printer features as they become available in the future, and make implementation of future SDK versions much easier!

[Back to top]

## Creating Custom Printer Drivers With The SDK

While it is expected that the developer will have to write some O/S or device-specific code in order to implement a printer driver on to their host system, the SDK has been structured in such a way that most new code incorporated by the developer should be isolated from the core code. As such, most of the required changes to the core code should be limited to the object or module responsible for creating an O/S (Operating System) and hardware abstraction layer for the rest of the driver. This is called the SystemServices object. Once this abstraction layer has been created, new versions of the SDK can easily be dropped into the existing driver framework.

Hewlett-Packard strongly discourages altering parts of the SDK that are device-independent. Although Hewlett-Packard has made the SDK code visible, the purpose of this was to allow the developer flexibility to build and test their own printer driver, not to change the behavior of the device-independent code. If the SDK code is altered at the device-independent level, developers will most likely experience difficulty when integrating future SDK versions, as well as encounter unsupported problems with the current SDK version.

If the developer discovers a major defect in the device-independent portion of the SDK code, they are encouraged to fix the problem in their own driver, and immediately notify Hewlett-Packard of the problem/recommended solution so that it can be considered for inclusion in future versions of the SDK. This will help to minimize future integration efforts by other developers.

Upon completion of the printer driver, Hewlett-Packard highly recommends that developers test their printer drivers using the test documents included with the SDK, or accessible via the SPP website. These documents have been chosen for their ability to test virtually all aspects of the driver. Developers are then strongly encouraged to email the printer driver output in the form of script files back to Hewlett-Packard for print quality review. Hewlett-Packard can then work with the developer to identify print quality issues and correct them. For more information on submitting the script files, refer to the Final Validation section in Testing.

[Back to top]

## SDK Contents

The SDK kit includes the following downloadable files:

DOCUMENTS:

API - Gives a brief description of the four public classes used to run the driver, their class members, and an appendix of enums, data types, and error codes.

Best Practices For Optimal Printing - Gives suggestions for printing the "optimal page", including how to avoid common pitfalls such as printing light text on dark backgrounds, and paginating around graphics. Includes the following sections:

> - Image/Text Resolution

> - Formatting and Layout for the Screen vs. the Printer

> - Clipping to the Printed Page

Debugging - Gives instructions on producing a record of SDK code usage, to be used by Hewlett-Packard in analyzing implementation. Includes the following sections:

> - Debugging A Driver With Scripts

> - Recording A Script

Device-Based Fonts - Explains device-based text as well as print quality and performance tips and tricks. Includes the following sections:

> - Overview

> - Enumerating Available Fonts

> - Realizing the Desired Font

> - Page Formatting and GetTextExtent

> - TextOut

> - The X Coordinate

> - The Y Coordinate

> - Additional Information / See Also

Getting Started - Covers downloading instructions, minimum system requirements, and installation instructions. Includes the following sections:

> - Minimum System Requirements

> - Building Your Driver

Glossary - Definitions of frequently used (and not always understood) words.

Host System Interface - Describes the host system interface including message codes, warnings and errors, and the HTML Help system. Includes the following sections:

> - User Interfaces & Guidelines

>   - Warnings and Errors

>   - DisplayPrinterStatus

>   - HTML Help System

> - Memory Requirements

> - Abstract Class "System Services" To Be Implemented By Host System Interface

>   - 1284 Versus USB

> - Plug & Play Versus Uni-Directional

Low-Level I/O Support - Provides information to begin understanding low-level I/O support and the SDK. Topics include:

> > - Low-Level I/O Support

> > - Adding Parallel or USB Hardware

> > - USB Documentation Sources

> > - Parallel / IEEE 1284 Documentation

Printing - Lists the printers and features supported, print modes, minimum functionality, and scaling and resolution. Includes the following sections:

> - Printers and Features Supported

> - Minimum Functionality

> - Print Modes

> - Scaling and Resolution

Sample Code - Gives examples of a calling sequence for a minimum driver, and a host environment requiring scaling. Includes the following sections:

> - Minimal Sequence

> - Using ASCII Text

> - User Interface Calling Code Sample

> - Additional Information

Testing - Describes compatibility, print quality, exception and performance testing, and final validation. Includes the following sections:

> - Compatibility

> - Error Handling

> - Print Quality

> - Performance

> - Final Validation

SOURCE CODE:

Tools

Benchmark Print Samples

Test Files

PCL Files

Sample HTML Files

Tools

[Back to top]