› Clovertech Forums › Read Only Archives › Cloverleaf › General › Transmitting documents via HL7 › Reply To: Transmitting documents via HL7
We successully tested encoding a PDF file into an OBX segment and having the other side unencode it. We currently do not do this in a live environment, but we did go as far as testing it out. We used the following xltp in the translate. The key xlateInVals is the fileName which is read in and Base64 encoded.
Hope that helps.
Rick
######################################################################
# Name: xltEncodeFile
# Purpose:
# UPoC type: xltp
# Args: none
# Notes: All data is presented through special variables. The initial
# upvar in this proc provides access to the required variables.
#
# This proc style only works when called from a code fragment
# within an XLT.
#
proc xltEncodeFile {} {
upvar xlateId xlateId
xlateInList xlateInList
xlateInTypes xlateInTypes
xlateInVals xlateInVals
xlateOutList xlateOutList
xlateOutTypes xlateOutTypes
xlateOutVals xlateOutVals
lassign $xlateInVals labCode dataType dataSubType encoding fileName
set fi [open $fileName r]
fconfigure $fi -translation {binary binary}
set en64Var $labCode^$dataType^$dataSubType^$encoding^[encode [read $fi]]
close $fi
set xlateOutVals $en64Var