Function typst_pdf::pdf

source ·
pub fn pdf(
    document: &Document,
    ident: Smart<&str>,
    timestamp: Option<Datetime>
) -> Vec<u8>
Expand description

Export a document into a PDF file.

Returns the raw bytes making up the PDF file.

The ident parameter, if given, shall be a string that uniquely and stably identifies the document. It should not change between compilations of the same document. If you cannot provide such a stable identifier, just pass Smart::Auto rather than trying to come up with one. The CLI, for example, does not have a well-defined notion of a long-lived project and as such just passes Smart::Auto.

If an ident is given, the hash of it will be used to create a PDF document identifier (the identifier itself is not leaked). If ident is Auto, a hash of the document’s title and author is used instead (which is reasonably unique and stable).

The timestamp, if given, is expected to be the creation date of the document as a UTC datetime. It will only be used if set document(date: ..) is auto.