mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-11-24 21:19:37 +00:00
feat: add no_pdf_tags, ppi, and more pdf_standard to extra args (#2220)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
- `--no-pdf-tags` to disable tagged PDF - `--ppi` to specify the PPI (pixels per inch) for PNG export - `--pdf-standard`: add all rest commonly used PDF standards, which was introduced in `typst` v0.14.0
This commit is contained in:
parent
7c00eba127
commit
a6adbaa926
10 changed files with 216 additions and 44 deletions
|
|
@ -35,14 +35,36 @@ impl<F: CompilerFeat> ExportComputation<F, TypstPagedDocument> for PdfExport {
|
|||
.pdf_standards
|
||||
.iter()
|
||||
.map(|standard| match standard {
|
||||
tinymist_world::args::PdfStandard::V_1_4 => typst_pdf::PdfStandard::V_1_4,
|
||||
tinymist_world::args::PdfStandard::V_1_5 => typst_pdf::PdfStandard::V_1_5,
|
||||
tinymist_world::args::PdfStandard::V_1_6 => typst_pdf::PdfStandard::V_1_6,
|
||||
tinymist_world::args::PdfStandard::V_1_7 => typst_pdf::PdfStandard::V_1_7,
|
||||
tinymist_world::args::PdfStandard::V_2_0 => typst_pdf::PdfStandard::V_2_0,
|
||||
tinymist_world::args::PdfStandard::A_1b => typst_pdf::PdfStandard::A_1b,
|
||||
tinymist_world::args::PdfStandard::A_1a => typst_pdf::PdfStandard::A_1a,
|
||||
tinymist_world::args::PdfStandard::A_2b => typst_pdf::PdfStandard::A_2b,
|
||||
tinymist_world::args::PdfStandard::A_2u => typst_pdf::PdfStandard::A_2u,
|
||||
tinymist_world::args::PdfStandard::A_2a => typst_pdf::PdfStandard::A_2a,
|
||||
tinymist_world::args::PdfStandard::A_3b => typst_pdf::PdfStandard::A_3b,
|
||||
tinymist_world::args::PdfStandard::A_3u => typst_pdf::PdfStandard::A_3u,
|
||||
tinymist_world::args::PdfStandard::A_3a => typst_pdf::PdfStandard::A_3a,
|
||||
tinymist_world::args::PdfStandard::A_4 => typst_pdf::PdfStandard::A_4,
|
||||
tinymist_world::args::PdfStandard::A_4f => typst_pdf::PdfStandard::A_4f,
|
||||
tinymist_world::args::PdfStandard::A_4e => typst_pdf::PdfStandard::A_4e,
|
||||
tinymist_world::args::PdfStandard::Ua_1 => typst_pdf::PdfStandard::Ua_1,
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
)
|
||||
.context_ut("prepare pdf standards")?;
|
||||
|
||||
let tagged = !config.no_pdf_tags && config.pages.is_none();
|
||||
// todo: emit warning diag
|
||||
if config.pages.is_some() && !config.no_pdf_tags {
|
||||
log::warn!(
|
||||
"the resulting PDF will be inaccessible because using --pages implies --no-pdf-tags"
|
||||
);
|
||||
}
|
||||
|
||||
// todo: Some(pdf_uri.as_str())
|
||||
// todo: ident option
|
||||
Ok(Bytes::new(typst_pdf::pdf(
|
||||
|
|
@ -54,6 +76,7 @@ impl<F: CompilerFeat> ExportComputation<F, TypstPagedDocument> for PdfExport {
|
|||
.map(|pages| exported_page_ranges(pages)),
|
||||
timestamp: Some(timestamp),
|
||||
standards,
|
||||
tagged,
|
||||
..Default::default()
|
||||
},
|
||||
)?))
|
||||
|
|
|
|||
|
|
@ -243,6 +243,12 @@ pub struct ExportPdfTask {
|
|||
/// conformance with.
|
||||
#[serde(skip_serializing_if = "Vec::is_empty", default)]
|
||||
pub pdf_standards: Vec<PdfStandard>,
|
||||
/// By default, even when not producing a `PDF/UA-1` document, a tagged PDF
|
||||
/// document is written to provide a baseline of accessibility. In some
|
||||
/// circumstances (for example when trying to reduce the size of a document)
|
||||
/// it can be desirable to disable tagged PDF.
|
||||
#[serde(skip_serializing_if = "std::ops::Not::not", default)]
|
||||
pub no_pdf_tags: bool,
|
||||
/// The document's creation date formatted as a UNIX timestamp (in seconds).
|
||||
///
|
||||
/// For more information, see <https://reproducible-builds.org/specs/source-date-epoch/>.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue