Same here: recently we are getting embedded PDFs in ORU messages. The embedded PDF is base64 encoded when we receive it. We take this base64 part, decode it and write it to a file. Then the receiving system gets a message with a pointer to this PDF-file.
Here is the part where the file is written; the pdf-part is in $b64:
package require base64
…
set fileId [open $fileout “w”]
fconfigure $fileId -translation binary
puts -nonewline $fileId [::base64::decode $b64]
close $fileId
Remember to configure the file as binary, or you won’t be able to open the pdf correctly.
The other way around (receiving a pdf-file and sending it out as embedded) shouldn’t be any more difficult.
Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands