How do I include PDF file binary data in the XML document?

Base64 is an encoding mechanism used to represent binary data as text characters. Triplets of 8-bit octets are encoded as groups of four characters, each representing 6 bits of the source 24 bits. This is one way of enabling binary data to be included in a text (UTF-8) document, such as an XML document.

To include the PDF file binary data in the XML document, the PDF file would first have to be encoded in Base64 (using an API function that varies dependent on the development/target environment), and then put the resulting Base64 encoded data (which is really text characters at this point) between < BinaryObject.Base64 > and < /BinaryObject.Base64 >.

It is recommended that binary data (in the BinaryObject.Base64 element) be accompanied by a BinaryFormatText element, that contains a description of the type of binary data, so that a processing application understands how to interpret the data.  It is further recommended that the standard IANA MIME media type descriptions be used for types covered by those descriptions; for example, PDF data would be designated by <BinaryFormatText>application/pdf</BinaryFormatText>.

The IANA MIME Media Types are defined here: