Announcement

Collapse
No announcement yet.

encapsulate pdf in mirth

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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:
    CHANNEL: PROVA PDF
    CONNECTOR: sourceConnector
    SCRIPT SOURCE:
    SOURCE CODE:
    56: //var encodedContent = Packages.org.apache.commons.codec.binary.Base64.en codeBase64String(contents);
    57:
    58: //var contents = FileUtil.readBytes('C:/HL7DOCS/docteste.doc');
    59: var encData=FileUtil.encode(Packages.java.lang.String( contents).getBytes());
    60:
    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");
    LINE NUMBER: 61
    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

  • #2
    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?

    Comment


    • #3
      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.

      Comment

      Working...
      X