jCIFS printing


LiveCycle Output service has a capability to print on a network printer using CIFS protocol. This protocol requires user credential to access that printer. The API doesn’t take those credentials (username and password) as an parameter due to security reasons. Instead this API uses the existing LiveCyle infrastructure named TrustStore to store user credentials.

It would be a tedious task to store user credentials for each printer that the LiveCycle application is going to use as there can be thousands of printers. And to make matter worse, the set of printers might be changing dynamically. This tech note caters such use cases by defining syntax and some limited set of rules to match printers against the user credentials.

Detailed Description

The sendToPrinter API described in my earlier post have been enhanced to support CIFS protocol also.

void sendToPrinter(Document document, Enum accessMechanism, String printServerUri, String printerName)

You need to choose jCIFS as accessMechanism to trigger print using this protocol. printerName parameter is not used by this API. You need to just pass the valid document and printServerUri to use this API. As mentioned in the introduction, you can specify credentials in TrustStore like the following:

TrustStore simplified

Describing the various functionalities of the TrustStore is beyond the scope of this document. One can refer to LiveCycle documents for that. I just aim to describe the functioning of TrustStore from Output Service point of view.
TrustStore stores user name and password against an alias. So one can think of TrustStore as a map where keys are aliases and the values are user credentials.
One entry in TrustStore looks like the following:

alias domain\username password

Need for defining syntax of the TrustStore alias

In order to print a document on a printer, we need user credentials and one can get user credentials from TrustStore map only if we know the alias. So there is a definite need to establish mapping between printer uri and an alias so that one can guess the possible aliases for lookup based on the printer uri.

Rules/Priorities for aliases

The generic printer uri looks like following:


We’ll lookup the various possible aliases in following order:

1. \\print-server.domain.name.com\printer
2. \\print-server.domain.name.com
3. \\domain.name.com
4. \\name.com
5. \\com
6. \\

As soon as we find match in the TrustStore map, we stop looking further. One cannot store multiple credentials against same alias as alias serves as key in the TrustStore map.