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)
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();
}
```