Pdf values to BAML functions can be created in client libraries. This document explains how to use these functions both at compile time and runtime to handle Pdf data. For more details, refer to pdf types.
Pdf
instances must be created from Base64 or local file data; URLs are not supported.
Usage Examples
Static Methods
fromBase64
Creates a Pdf object using Base64 encoded data along with the given MIME type.
fromFile
Only available in browser environments. @boundaryml/baml/browser
Instance Methods
asBase64
Get the base64 data and media type if the Pdf is stored as base64. Returns [base64Data, mediaType]. Throws an Error if the Pdf is not stored as base64.
toJSON
Convert the Pdf to a JSON representation. Returns a base64 object with media type.