Printing using the Java SDK with an InputStream (no file)

// Expert user has replied.
J Josh Blease 3 years 6 months ago
37 1 0

Hi team,
Our system fetches PDF objects from a file store and our current implementation of printing is based around using this object as an InputStream.
Looking at the Zebra Java SDK I am trying to print directly to the printer without having to save the file to the host machine at all.
This doesn't seem possible at the moment as I can only find the FileUtil class which takes in a file location to send to a printer. Is there any code I've not found that can achieve this or can I raise a feature request?
It appears that it could be easily implemented using the ZebraFileConnection class as I can provide the InputStream and the fileSize, but there are deep within the SDK and not available for use by the average developer.
Thanks,
Josh

Please Register or Login to post a reply

1 Replies

S Steven Si

The printer.sendFileContents(filePath) is a convenient way to send the data in a file to the printer. The underneath implementation of sendFileContents() is to convert the file into InputStream and then send the data in the InputStream in chunks to the printer. Since you already have the data in a InputStream, then you can read the data in chunks from the InputStream and send the data one chunk at a time to the printer with connection.write() API.
 

CONTACT
Can’t find what you’re looking for?