Skip to main content

PdfExportOptions

Struct PdfExportOptions 

Source
pub struct PdfExportOptions {
Show 18 fields pub page_width_mm: f32, pub page_height_mm: f32, pub margin_top_mm: f32, pub margin_bottom_mm: f32, pub margin_left_mm: f32, pub margin_right_mm: f32, pub font_family: String, pub font_bytes: Vec<Vec<u8>>, pub font_size_pt: f32, pub line_spacing: f32, pub first_line_indent_mm: Option<f32>, pub paragraph_spacing_pt: Option<f32>, pub justify: bool, pub base_rtl: bool, pub lang: Option<String>, pub title: Option<String>, pub author: Option<String>, pub include_preamble: bool,
}
Expand description

Page geometry + typography + embedded font bytes for a PDF export.

All lengths are in millimetres (matching Preset’s existing unit in callers such as Skribisto’s compiler); they are converted to Typst’s cm/pt length literals at markup-emission time, not here — this struct stays a plain, unit-tagged data record.

Fields§

§page_width_mm: f32

Page width, in millimetres.

§page_height_mm: f32

Page height, in millimetres.

§margin_top_mm: f32

Top page margin, in millimetres.

§margin_bottom_mm: f32

Bottom page margin, in millimetres.

§margin_left_mm: f32

Left page margin, in millimetres.

§margin_right_mm: f32

Right page margin, in millimetres.

§font_family: String

Body font family name, emitted as #set text(font: ..). Empty ⇒ the emitter omits the font: argument entirely, letting Typst fall back to its own built-in default face.

§font_bytes: Vec<Vec<u8>>

Raw TTF/OTF font blobs, handed directly to the embedded Typst compiler’s .fonts(..). At least one entry is required for document_io::typst_compile::compile_typst_pdf to succeed; this struct itself does not enforce that (Default is an empty list).

§font_size_pt: f32

Body font size, in points.

§line_spacing: f32

Paragraph line spacing (Typst leading), in em. Typst’s own default is 0.65.

§first_line_indent_mm: Option<f32>

First-line paragraph indent, in millimetres. None ⇒ no first-line indent.

§paragraph_spacing_pt: Option<f32>

Extra space after each paragraph, in points. None ⇒ Typst’s own default spacing.

§justify: bool

Justify body paragraphs (document-level default; per-block alignment still overrides).

§base_rtl: bool

Document-level base reading direction. Per-block RTL (fmt_direction) still wraps its own content in a local #text(dir: ..) override regardless of this value.

§lang: Option<String>

Document-wide primary language, as an ISO 639-1 tag (e.g. "en", "fr"), emitted as #set text(lang: ..). None ⇒ the emitter omits the lang: argument.

§title: Option<String>

PDF /Title metadata (via #set document(title: ..)). None ⇒ no title is emitted — Typst/krilla’s own defaults apply (no explicit /Title).

§author: Option<String>

PDF /Author metadata (via #set document(author: ..)). None ⇒ no author is emitted.

§include_preamble: bool

Emit the #set page/text/par/smartquote/heading preamble. Mirrors ExportLatexDto.include_preamblefalse produces a bare body, e.g. for embedding this export’s markup inside a larger hand-authored Typst document.

Trait Implementations§

Source§

impl Clone for PdfExportOptions

Source§

fn clone(&self) -> PdfExportOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PdfExportOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for PdfExportOptions

Source§

fn default() -> PdfExportOptions

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for PdfExportOptions

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<PdfExportOptions, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for PdfExportOptions

Source§

fn eq(&self, other: &PdfExportOptions) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for PdfExportOptions

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for PdfExportOptions

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.