For Developers

PrintingSample

This document describes integration with PrintHand, a mobile printing application for Android devices.

Purpose: Integration with PrintHand to provide printing capabilities to 3rd party applications.

Depending on the application, its content and other requirements, there are several integration options available.

Ways to integrate with PrintHand:

PrintingSample application shows all the listed integration options in action.

Project requirements: Android Studio 2.2.2, gradle plugin 2.2.2, Android build tools 23.0.3, Android support v4 library version 23.2.1, Android v7 appcompat library.

Integration via Share Intent

This is the easiest way to integrate with PrintHand based on the standard Android Share Intent. With Share Intent one can send data to the PrintHand (or to any other app capable of receiving the content type specified when sending the intent).

Requirements:

Many Android apps (i.e. Gallery) already have sharing mechanism implemented. Without any knowledge of PrintHand such apps can use Share Intent to send their content to be printed.

Features:

Example:

Recap:

As you can see, this is the easiest and fastest option to integrate with PrintHand since it handles rendering and all the control over the printout on its own.

Our tip:

We recommend sticking to this option if you would like to add printing capabilities to your app with almost zero effort required.

Integration via PrintHand Intent API

With this integration option you can get better control over the rendering process and printing options. The main idea is that the 3rd party application would be capable of altering the printing options directly using it’s own UI elements. Therefore it can render the content specifically for the specific printer model, and give the user the options to adjust settings.

Requirements:

Features:

Example:

Recap:

This integration scenario is similar in a way to printing documents from Microsoft Office suite on Windows where the application (i.e. Microsoft Word) controls print preview and options, while actual printing is done through a series of calls to print driver.

This method is useful for integrating with applications working with complex content such as office documents, maps, etc.

Integration via PrintHand Printing SDK

When sticking to this option, 3rd party application can take full control of printing process calling PrintHand Printing SDK directly. The service is running in the background, does not directly interact with users and doesn't have any UI elements. This is the same service PrintHand application is calling when providing printing functionality.

Requirements:

Features:

Example:

Recap:

While providing greatest flexibility, this approach also brings significant complexity since the 3rd party app is responsible for the UI, rendering and setup.

The data is supplied by the 3rd party app as binary stream to the PrintHand Printing service directly. 3rd party application and the PrintHand Printing service run within the same process.

Our tip:

This option is designed for those who do not want/need the PrintHand app to be installed on the target device or its UI to be invoked due to various reasons (e.g., branding).

It is recommended for applications requiring full control of the printing process and the UI.

While providing greatest flexibility, this approach also brings significant complexity since the 3rd party app is responsible for the UI, rendering and setup.