web stats
PDF Document Writer and base 64 encoded images - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 02-17-2017, 03:38 AM
lionelroux lionelroux is offline
OBX.2 Kenobi
Join Date: Apr 2013
Posts: 82
lionelroux is on a distinguished road
Exclamation PDF Document Writer and base 64 encoded images


I've a channel that uses raw HTML code extracted from an Alfresco CMIS repository.
It generates a PDF document using Document Writer.

The HTML content embeds base 64 encoded images like the following :

HTML Code:
<img src="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEBGAEYAAD/4QgARXhpZgAASUkqAAgAAAAQAP4ABAABAAAAAAAAAAABAwABAAAAYwEAAAEBAwABAAAAywEAAAIBAwADAAAAzgAAAAMBAwABAAAAAQAAAAYBAwABAAAA/wBHQ6knvZuxkrJWdH4+d1g7BwWxuWs9JXKgqKOquUboZmljhunkfQspuOFgiq8Fu62ucotNvbbpyNVtYqo67SdoqoTmOWqje3zEFWSwjcbkjkqqq6rRFVp6ms8t7nNLTv32O3jvjnwzu8uK6+/o/PDVd0HX/Lu/wrDScUiWnYX9OrKo6TepLr4fQ3V0/PPac/I3.../eHFbDTWk7BpiF0dgtNHQNd8IwRBpd5zzKA62znTEOjtFWqxwEO70hDZHj48hOXH1kqoe7M/IvTn+t2f7N69BLWX/T9o1DTxQX220lwhif0sbKmISBr8Y3gDyOCUB3Lf/MKb9U36gvusNaGNDWgBoGAB1BZQH//2Q==" style="height: 153px; width: 118px;"/>
Everything works fine except images that do not appear in the PDF document.

Is there a solution to make them displayed ?

beforehand, thks

PS : I'm using mirth 3.4.2

Edit : I already asked for this 2 years ago in this thread :https://www.mirthproject.org/communi...ad.php?p=47180

Last edited by lionelroux; 02-17-2017 at 04:48 AM.
Reply With Quote
Old 02-20-2017, 12:27 PM
jackwhaines jackwhaines is offline
Join Date: May 2011
Location: Kansas City, Missouri
Posts: 254
jackwhaines is on a distinguished road
Send a message via Skype™ to jackwhaines

It doesn't look like Mirth supports the Data URI method like this, but you could always write a temp file then reference it:

var data = "[base64-encoded data]";
var decoded = FileUtil.decode(data);
var fileName = "temp.jpg";
FileUtil.write(fileName, false, decoded);
<img src="temp.jpg"/>
Note #1: The base64 data that you posted doesn't seem to be valid.
Note #2: When you don't put a path to the filename that is written to/read from, it will write in your Mirth path, so you might want to use /tmp/file.jpg or similar.

-= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
-= jack.haines@HealthcareIntegrations.com
-= Mirth Connect (Advanced)-certified
-= Gold member of HL7.org
-= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 04:52 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation