JCIFS library modified to support CIFS print protocol


The changes described in this article apply to Adobe LiveCycle and AEM forms lines of products.

JCIFS is a library implementing the CIFS protocol in pure java and is licensed under LGPL. The JCIFS versions considered here are 1.2.18 and krb5-1.3.1. The distribution containing the source is at: http://jcifs.samba.org/src/

The LGPL license for this library is here: http://www.gnu.org/licenses/lgpl-2.1.txt

Reasons to use the CIFS print protocol

CIFS protocol enables a computer to share its local printer with remote computers over the network. To print to a remote printer shared on a CIFS server, the clients need the ability to talk to the CIFS server using CIFS protocol. The CIFS print protocol specification is at:


Modifications to the JCIFS library

As the JCIFS library lacks support for the CIFS print protocol, the following modifications have been made. For details on the changes made to the JCIFS library.

  1. Added the following methods to SmbFile.java:
    • print - used to print contents of the given input stream to the specified printer
    • print_open
    • close- used to send SMB_CLOSE_PRINT_FILE packet when type of present open resource is printer
  2. Added case statements to send method of SmbTree “ allows sending SMB_COM_OPEN_PRINT_FILE, SMB_COM_CLOSE_PRINT_FILE and SMB_COM_WRITE_PRINT_FILE packets.
  3. Added new packet codes to ServerMessageBlock.java as defined by CIFS protocol.

  4. Added the following classes to jcifs.smb:
    • SmbComOpenPrintFile- used to open a print spool on a shared printer queue
    • SmbComOpenPrintFileResponse- response packet received from the server after opening the print spool file
    • SmbComWritePrintFile- represents the network packets sent to the server to write to a previously opened print spool file
    • SmbComClosePrintFile- a network packet sent to close a print spool file after which printing is assumed to begin