Announcement

Collapse
No announcement yet.

Hl7 message "PDF file Size" contains more than one block fails create pdf

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

  • 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);
    }
    }
Working...
X