Printer Client
Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com

Printer Client

Introduction

OpenSpecimen creates print command files that must be transferred to the machine on which printer software is installed, e.g. Bartender, NiceLabel, etc. This poses networking challenges when OpenSpecimen is hosted on a different network than the printer software.

This program uses the REST APIs to download the files from OpenSpecimen every X seconds.

Perquisites

  1. Java 17 installation

A. Windows: Deployment steps

B. Linux: Deployment steps

  1. Configure the printer.properties file

Attribute

Explanation

Attribute

Explanation

url

Server url from which you are trying to download the print labels. (e.g. https://test.openspecimen.org)

username

Username to login with the “Manage Print Jobs” option enabled on the user profile page.

It is recommended to create a dedicated user who has no role assigned but only has “Manage Print Jobs” enabled.

password

Password of the user.

data_directory

Data directory path to store program data.

Default: “./"

download_directory

Absolute path of the directory where the command files should be created on the printer VM.

Default: ./print_labels

directory_per_design

Values: true/false

Default: false

Setting indicating whether a different directory should be created for each label type or all files should be placed in the same directory.

printers

Comma-separated list of printer names. This is useful if you have multiple locations from where you print. Using this you can download files for specific printers.

polling_interval

Polling interval in seconds to specify how often the server should be checked for the new command files.

Default: 60

batch_file_download

Either true/false. To download multiple labels into a single file.

batch_file_format

csv,txt..n. The format of the file.

batch_file_label_delimiter

This will output ***** between key-value pairs of every label.

e.g. printer.properties file.

url=<SERVER_URL> username=<USERNAME> password=<PASSWORD> data_dir=./ download_directory=./print-labels directory_per_design=true printers=printer1,printer2,printer3,printer4,printer5 polling_interval=60 batch_file_download=true batch_file_format=csv batch_file_label_delimiter=*****\n
  1. Downloading jar file: (Email to support@krishagni.com for downloading the jar file)

 

Security Best Practices

  • Ensure the 'Print User' in OpenSpecimen does not have the 'Superadmin' role. Ideally, this user should be a 'Regular' user with no roles assigned.

  • In the user profile for the 'Print User,' set the 'Manage Print Jobs' permission to "Yes."

  • Restrict the allowed IP addresses to those originating from within your organization (IP ranges are acceptable).

  • Configure the email notifications to be sent to a valid and monitored mailbox. We suggest using an email alias to ensure that critical notifications like password expiry, resets, or errors are not overlooked.


How to run the program?

  1. Navigate to os-print-client directory.

  2. Configure the printer.properties file.

  3. Command to run the program: java -Dconf=printer.properties -jar os-printer-client-1.1.0.jar

How to install as a service on Windows?

A. Create a batch file

@echo off cd <PATH-TO-OS-PRINTER-CLIENT-DIR> java -Dconf=printer.properties -jar os-printer-client-1.1.0.jar >> <PATH-TO-LOG-FILE> 2>&1

B. Install service

Open command prompt, and run the below command to install it as a service.

sc create "OSPrinterClient" binPath= "<BATCH-FILE-PATH>\start_os_printer_client.bat"

How to stop the service on Windows?

Once the OS Printer Client is installed as a Windows service, you can stop it anytime using the Windows Service Manager or the Command Prompt.

A. Stop the Service Using Services Console

  1. Press Windows + R to open the Run window.

  2. Type services.msc and press Enter.

    runWindow.png
  3. In the Services window, scroll down and locate OSPrinterClient.

    servicesWindow.png
  4. Right-click the service and select Stop.

  5. The service will stop, and the program will no longer run in the background.


B. Stop the Service Using the Command Prompt

  1. Open Command Prompt with Administrator privileges.

  2. Run the following command:

sc stop "OSPrinterClient"

This sends a stop signal to the service. The status will change from Running to Stopped once the program shuts down.


Frequently Asked Questions

Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com