mirror of
https://github.com/typst/typst
synced 2025-08-16 16:08:32 +08:00
Pick correct PDF version automatically based on substandard
This commit is contained in:
parent
774d7e819e
commit
6c84f392b2
@ -105,16 +105,20 @@ impl PdfStandards {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let version = version.unwrap_or(PdfVersion::Pdf17);
|
let config = match (version, validator) {
|
||||||
let validator = validator.unwrap_or_default();
|
(Some(version), Some(validator)) => {
|
||||||
|
Configuration::new_with(validator, version).ok_or_else(|| {
|
||||||
let config = Configuration::new_with(validator, version).ok_or_else(|| {
|
|
||||||
eco_format!(
|
eco_format!(
|
||||||
"{} is not compatible with {}",
|
"{} is not compatible with {}",
|
||||||
version.as_str(),
|
version.as_str(),
|
||||||
validator.as_str()
|
validator.as_str()
|
||||||
)
|
)
|
||||||
})?;
|
})?
|
||||||
|
}
|
||||||
|
(Some(version), None) => Configuration::new_with_version(version),
|
||||||
|
(None, Some(validator)) => Configuration::new_with_validator(validator),
|
||||||
|
(None, None) => Configuration::new_with_version(PdfVersion::Pdf17),
|
||||||
|
};
|
||||||
|
|
||||||
Ok(Self { config })
|
Ok(Self { config })
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user