baml.media.Pdf
A PDF document value.
Signature
class baml.media.PdfA PDF document value.
Backed by a URL or by base64-encoded content. A file is read when the value is built from it: the value holds its content, never its path.
Source:<builtin>/baml/ns_media/media.bamlbytes 177–2805
Fields
_data
$rust_typeStatic methods
from_base64
(base64: string, mime_type: string | null) -> pdf throws neverCreates a Pdf value from a base64-encoded string. Optionally specify mime_type.
from_file
(Creates a Pdf value from the content of a local file, which is
read now. The value is named by the file's base name. Optionally
specify mime_type; otherwise it is inferred from the file's name.
Throws
Ioif the file cannot be opened or read.InvalidArgumentonly asbaml.fs.opendeclares it: a path that cannot be opened isIo.
from_file_content
(file: string, base64: string, mime_type: string | null) -> pdf throws neverCreates a Pdf value from base64-encoded content that was read
from file. The value is named by the file's base name. Optionally
specify mime_type; otherwise it is inferred from the file's name.
from_url
(url: string, mime_type: string | null) -> pdf throws neverCreates a Pdf value from a URL. Optionally specify mime_type (defaults to "application/pdf").
infer_mime_type
(source: string) -> string throws neverReturns the MIME type that source, a file name or URL, implies for
a PDF: by its extension, or the usual type for a PDF when the
extension says nothing. A URL's query and fragment are not part of
its extension.
Instance methods
base64
(self) -> string throws neverReturns the base64-encoded content of this PDF.
mime_type
(self) -> string | null throws neverReturns the MIME type of this PDF, or null if not set.
name
(self) -> string | null throws neverReturns the name of this PDF, or null if it has none. A PDF built from a
file is named by the file's base name.
url
(self) -> string | null throws neverReturns the URL of this PDF, or null if it was not constructed from a URL.
Implementations
baml.Concrete for T
Source:<builtin>/baml/core.bamlbytes 763–795