There is a lot of structure to PDF files that we don’t have built-in tools for in Cloverleaf. There’s not much detail here about your requirements, but you might want to check out a package like pdf4tcl. Make sure whatever you use to actually write the file is has binary mode set. If you are going to embed the PDF in an HL7 message, watch out for any required escaping of HL7 delimiter characters.