Mirth Connect uses iTextpdf and barcode 128 is not an included font. I downloaded code128.ttf font, but how can I reference this with javascript in Mirth Connect? Maybe someone has a Mirth channel that does this or something similar?
Another possibility is Mirth Connect has a Document Writer template option which can use HTML/CSS to reference the local font. I tried many variations of HTML/Inline CSS to no avail.
There are a number of barcode image generator libraries for Java. Create your own Java class that does everything you need, deploy to the /custom-lib folder in the Mirth installation and call the class in your channel’s source or destination transformer JS step.
I did it by writing the barcode to a temporary file and referencing that in the Document Writer HTML.
Add a JavaScript transformer step to your destination Document Writer:
Then just reference the image in your HTML template:
As a bonus you can add a Javascript Writer destination to delete the image afterwards: