Randy Stewart · May 8, 2017

How would one convert an image to a PDF using HealthShare

Suppose I have an image and need to convert that image into a PDF for inclusion in an HL7.

I know that Zen Reports can display an image in a PDF but I do not want to view the image in a web page. I just need to convert the image to PDF in a Process and then include that PDF in an HL7. The  workflow would be like this:

Get image -> Convert image into PDF -> Include PDF in HL7 OBX.

I know how to do the last part to include PDF in HL7 OBX. Just need ideas on the first part.


0 0 2 854
Log in or sign up to continue

Hi Randy,

I've been around the block on this problem.

There is no simple native solution. I have tried to create a native COS to PDF generator but its a much bigger problem than time affords.

I know you are asking for a solution that does not include creating a web page, BUT, with exception of going to some other document type (e.g. DOC to PDF) you really have no other easy choice.

However, there is a better way than Zen reports to implement this (IMHO). I use wkhtmltopdf...

It's an executable that takes the name of an HTML file and produces a PDF file. You can also control headers, page numbers etc with it. It's rock solid and really easy to use.


1. Create a simple HTML string with an img tag and save it to a file.

2. Call out to wkhtmltopdf using $ZF passing in the name of the files


If you want to be clever and not save the image to a linked file then you can take its base64 directly from the HL7 message and embed it into the img tag, e.g.

<img src="data:image/png;base64,iVBORw0KGgo...">

I have wkhtmltopdf running at numerous hospitals turning out upwards of 10,000 letters a day, rock solid, no problems.

Hope that helps.


As a side thought. If all you want is an image in the PDF file and no text then you might also want to take a look at...

which is another battle tested library.

I have used it for image to image but not image to PDF so can't confirm how good it is.