hl7 sdk and imbedded base 64 pdf

Apr 8, 2016 at 4:08 AM
We have a need to imbed reports that are pdf into the hl7 message. Is there any functionality in this sdk to allow this to happen? If so which one would it be as I could not locate it. I know it has to be in hex or base64 before embedding it. Any examples would be great. thanks
Coordinator
Apr 8, 2016 at 8:58 AM
It's easy if you work with CDA. Please note that the library does not implement all the HL7 v3 standards and is intended to work with CDA only.
Here is an example:


static String EncodeFile(String path)
    {
        var byteArray = File.ReadAllBytes(path);
        var base64EncodedByteArray = Convert.ToBase64String(byteArray);
        return base64EncodedByteArray;
    }

    static void Main(string[] args)
    {
        var cd = new ClinicalDocument();
        // ...
        // populating patient info, authors etc skipped
        // ...
        var ed = new ED();
        ed.Text = EncodeFile(@"C:\Temp\OrderResult.pdf");
        ed.Representation = BinaryDataEncoding.B64;
        ed.MediaType = "application/pdf";
        cd.Component.AsNonXMLBody.Text = ed;
        Console.WriteLine(cd.Xml);
        Console.ReadLine();
    }
```