See also
- BinaryDecode for conversion of binary-encoded data, including Base64, to binary data
- cffile for information about loading and reading binary data
- cfwddx for information about serializing and deserializing binary data
- IsBinary and ToBase64 for checking format and converting to Base64
- Len for determining the length of a binary object
- Binary data type and binary encoding in Data types- Developing guide in the Developing ColdFusion Applications
Parameters
Parameter
|
Description
|
---|
Data
|
A variable representing data in Base64-encoded format or a PDF document.
|
Usage
The ToBinary function can take as a parameter a PDF document variable (specified by the cfpdf tag name attribute). In this case, the ToBinary function returns a byte array (byte[]) representation of the document. You can use the results of this function, for example, to store the PDF in a database as a BLOB, or, in a cfcontent tag, to write the PDF to the browser. You can use this binary representation with a read operation in the cfpdf tag to create a variable.The following example reads an unprotected PDF file, applies protections, and displays it in the browser: