web stats
encapsulate pdf in mirth - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 03-15-2017, 03:43 AM
EDL EDL is offline
What's HL7?
Join Date: Mar 2017
Posts: 2
EDL is on a distinguished road
Default encapsulate pdf in mirth

Hi All,

I'm trying to encapsulate pdf in HL7 to send with MLLP (in test mode is set File Writer channel). In input I read pdf stored in SQL DB.

In sours transformers add code find in forum to encapsulate file, but there is a follow error.

In attach the channel export, I use mirth v. 3.4.

Can you help me?

Transformer error
ERROR MESSAGE: Error evaluating transformer
com.mirth.connect.server.MirthJavascriptTransforme rException:
CONNECTOR: sourceConnector
56: //var encodedContent = Packages.org.apache.commons.codec.binary.Base64.en codeBase64String(contents);
58: //var contents = FileUtil.readBytes('C:/HL7DOCS/docteste.doc');
59: var encData=FileUtil.encode(Packages.java.lang.String( contents).getBytes());
61: var temp = encData;
62: var index = temp.indexOf("\r\n");
63: while(index != -1){
64: temp = temp.replace("\r\n","&newline;");
65: index = temp.indexOf("\r\n");
DETAILS: TypeError: Character reference "�" is an invalid XML character.
at 37b971ff-c329-46d5-94c2-48a41e8ba7cb:44 (doScript)
at 37b971ff-c329-46d5-94c2-48a41e8ba7cb:93
at com.mirth.connect.server.transformers.JavaScriptFi lterTransformer$FilterTransformerTask.doCall(JavaS criptFilterTransformer.java:154)
at com.mirth.connect.server.transformers.JavaScriptFi lterTransformer$FilterTransformerTask.doCall(JavaS criptFilterTransformer.java:119)
at com.mirth.connect.server.util.javascript.JavaScrip tTask.call(JavaScriptTask.java:113)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker( Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
at java.lang.Thread.run(Unknown Source)
Attached Files
File Type: xml encapsulate_pdf.xml (24.0 KB, 8 views)
Reply With Quote
Old 03-23-2017, 01:40 AM
EDL EDL is offline
What's HL7?
Join Date: Mar 2017
Posts: 2
EDL is on a distinguished road

Hi to All,

the problem is in reading the data from the db, mirth try to parse the field bimario as XML.

can someone help me?
Reply With Quote
Old 03-23-2017, 06:47 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
Join Date: Oct 2010
Posts: 7,116
narupley is on a distinguished road

Read in the bytes, then use FileUtil (or some other library) to convert that to Base64. Then either place that in the channel map, or use the addAttachment() method to create an attachment for it. Then make sure your File Writer destination is set to Binary mode.
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.

- How do I foo?
- You just bar.
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 10:23 PM.

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