web stats
Hl7 message "PDF file Size" contains more than one block fails create pdf - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 06-10-2019, 08:50 AM
midavies midavies is offline
Mirth Newb
 
Join Date: Dec 2017
Posts: 8
midavies is on a distinguished road
Default Hl7 message "PDF file Size" contains more than one block fails create pdf

I'm Newbie, no error generated - something not quite right with global variable - any ideas will be much appreciated

function to re-create pdf file from message received: when hl7 message contains one block file is created ok, but not when multiple block

var pdfBytes = [];

function DecodeBase64_3(base64pdf, filename, total, index) {

//var pdfBytes = org.apache.commons.codec.binary.Base64.decodeBase6 4(msg['OBX']['OBX.5']['OBX.5.1'].toString());
var pdfBytes0 = org.apache.commons.codec.binary.Base64.decodeBase6 4(base64pdf);
if(index == 1)
{
pdfBytes.length = 0;
pdfBytes = pdfBytes0.slice(0);
}
else
{
pdfBytes.concat(pdfBytes0);

}
//org.apache.commons.io.FileUtils.writeByteArrayToFi le(new java.io.File('C:/HL7/PDFBOX/'+UUIDGenerator.getUUID()+'.pdf'),pdfBytes,true);
if (total == index)
{
org.apache.commons.io.FileUtils.writeByteArrayToFi le(new java.io.File('C:/HL7/PDFBOX/' + total + index +filename),pdfBytes,false);
}
}
Reply With Quote
Reply

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 06:20 AM.


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