diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-10-03 21:40:42 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-03 19:40:42 +0000 |
| commit | 60f9f66950f1fbef3d6042533e768b9ee933dd24 (patch) | |
| tree | 223de6e8570d07e746c3857806cfce4a4727964d /crates/typst-pdf | |
| parent | 4e6021cf882197468ec9813ce0ed1044bce7b5d2 (diff) | |
Serialize and Deserialize for `PdfStandard` (#5108)
Diffstat (limited to 'crates/typst-pdf')
| -rw-r--r-- | crates/typst-pdf/Cargo.toml | 1 | ||||
| -rw-r--r-- | crates/typst-pdf/src/lib.rs | 7 |
2 files changed, 6 insertions, 2 deletions
diff --git a/crates/typst-pdf/Cargo.toml b/crates/typst-pdf/Cargo.toml index cdd65e82..64229945 100644 --- a/crates/typst-pdf/Cargo.toml +++ b/crates/typst-pdf/Cargo.toml @@ -27,6 +27,7 @@ miniz_oxide = { workspace = true } once_cell = { workspace = true } pdf-writer = { workspace = true } arrayvec = { workspace = true } +serde = { workspace = true } subsetter = { workspace = true } svg2pdf = { workspace = true } ttf-parser = { workspace = true } diff --git a/crates/typst-pdf/src/lib.rs b/crates/typst-pdf/src/lib.rs index 587f66cb..7df77f10 100644 --- a/crates/typst-pdf/src/lib.rs +++ b/crates/typst-pdf/src/lib.rs @@ -21,6 +21,7 @@ use std::ops::{Deref, DerefMut}; use base64::Engine; use pdf_writer::{Chunk, Name, Pdf, Ref, Str, TextStr}; +use serde::{Deserialize, Serialize}; use typst::diag::{bail, SourceResult, StrResult}; use typst::foundations::{Datetime, Smart}; use typst::layout::{Abs, Em, PageRanges, Transform}; @@ -128,16 +129,18 @@ impl Default for PdfStandards { } } -/// A PDF standard. +/// A PDF standard that Typst can enforce conformance with. /// /// Support for more standards is planned. -#[derive(Debug, Copy, Clone, Eq, PartialEq)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Serialize, Deserialize)] #[allow(non_camel_case_types)] #[non_exhaustive] pub enum PdfStandard { /// PDF 1.7. + #[serde(rename = "1.7")] V_1_7, /// PDF/A-2b. + #[serde(rename = "a-2b")] A_2b, } |
