package require base64set file test.pdf# base64 encode the .pdf fileset fi [open $file r]fconfigure $fi -translation binaryset pdf [base64::encode [read -nonewline $fi]]close $fi# Insert $pdf into the HL7 message# base64 decode the .pdf fileset fo [open test_out.pdf w]fconfigure $fo -translation binaryputs $fo [base64::decode $pdf]close $fo