mirror of
https://github.com/typst/typst
synced 2025-06-28 16:22:53 +08:00
Serialize and Deserialize for PdfStandard
(#5108)
This commit is contained in:
parent
4e6021cf88
commit
60f9f66950
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -2832,6 +2832,7 @@ dependencies = [
|
|||||||
"miniz_oxide",
|
"miniz_oxide",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"pdf-writer",
|
"pdf-writer",
|
||||||
|
"serde",
|
||||||
"subsetter",
|
"subsetter",
|
||||||
"svg2pdf",
|
"svg2pdf",
|
||||||
"ttf-parser",
|
"ttf-parser",
|
||||||
|
@ -129,7 +129,7 @@ pub struct CompileCommand {
|
|||||||
pub pdf_standard: Vec<PdfStandard>,
|
pub pdf_standard: Vec<PdfStandard>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A PDF standard.
|
/// A PDF standard that Typst can enforce conformance with.
|
||||||
#[derive(Debug, Copy, Clone, Eq, PartialEq, ValueEnum)]
|
#[derive(Debug, Copy, Clone, Eq, PartialEq, ValueEnum)]
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub enum PdfStandard {
|
pub enum PdfStandard {
|
||||||
|
@ -27,6 +27,7 @@ miniz_oxide = { workspace = true }
|
|||||||
once_cell = { workspace = true }
|
once_cell = { workspace = true }
|
||||||
pdf-writer = { workspace = true }
|
pdf-writer = { workspace = true }
|
||||||
arrayvec = { workspace = true }
|
arrayvec = { workspace = true }
|
||||||
|
serde = { workspace = true }
|
||||||
subsetter = { workspace = true }
|
subsetter = { workspace = true }
|
||||||
svg2pdf = { workspace = true }
|
svg2pdf = { workspace = true }
|
||||||
ttf-parser = { workspace = true }
|
ttf-parser = { workspace = true }
|
||||||
|
@ -21,6 +21,7 @@ use std::ops::{Deref, DerefMut};
|
|||||||
|
|
||||||
use base64::Engine;
|
use base64::Engine;
|
||||||
use pdf_writer::{Chunk, Name, Pdf, Ref, Str, TextStr};
|
use pdf_writer::{Chunk, Name, Pdf, Ref, Str, TextStr};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
use typst::diag::{bail, SourceResult, StrResult};
|
use typst::diag::{bail, SourceResult, StrResult};
|
||||||
use typst::foundations::{Datetime, Smart};
|
use typst::foundations::{Datetime, Smart};
|
||||||
use typst::layout::{Abs, Em, PageRanges, Transform};
|
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.
|
/// 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)]
|
#[allow(non_camel_case_types)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub enum PdfStandard {
|
pub enum PdfStandard {
|
||||||
/// PDF 1.7.
|
/// PDF 1.7.
|
||||||
|
#[serde(rename = "1.7")]
|
||||||
V_1_7,
|
V_1_7,
|
||||||
/// PDF/A-2b.
|
/// PDF/A-2b.
|
||||||
|
#[serde(rename = "a-2b")]
|
||||||
A_2b,
|
A_2b,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user