Question
David Foard · May 4, 2018

Convert HL7 to PDF

Is there anything native in Ensemble that will support converting HL7 to PDF?

I see there are numerous examples in .Net and Java for this capability.

Dave

0
0 1,415
Discussion (1)2
Log in or sign up to continue

Hi David,

There are a couple of options.

The first is ZEN reports, you can read more about them here...

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GRPT_reports

The solution is essentially built on top of Apache FOP.

Zen reports abstract some of the complexity of FOP, but you still need to learn ZEN's DSL syntax to get up and running.

Essentially you will create an XML data object in a format specified by the ZEN documentation, an XSLT stylesheet is applied to this, which produces Apache FOP XML. This is then passed into the FOP engine which outputs a PDF document.

It's not a straight forward solution, and if your not writing ZEN reports every day it might seem like a bit of a chore.

Personally I didn't want to learn and remember a new DSL when I am fluent in HTML and CSS, which is why I roll my own solutions on top of wkhtmltopdf...

https://wkhtmltopdf.org/

I have deployments built on top of this that have been generating millions of medical documents a year without a single problem.

Its easy enough to roll your own, just create an HTML string from within COS using data extracted from the HL7 message, include some CSS to format the text, tables etc, save this to a file, and then use the $ZF function to call out to the wkhtmltopdf exe.

You can pass in extra arguments on the call to add things like headers and footers, for instance this would add a page number

--footer-center [page]/[topage]

There is also another option that I am starting to lean towards and this is using the chrome browser in headless mode which enables support for more modern CSS features and allows for more creativity.

>"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --headless --disable-gpu --print-to-pdf=j:\TEMP\file1.pdf http://www.example.com/

I've got a half baked example of using Chrome, if it helps I could tidy it up a little and post it to GitHub.