mirror of
https://github.com/typst/typst
synced 2025-08-16 07:58: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 validator = validator.unwrap_or_default();
|
||||
|
||||
let config = Configuration::new_with(validator, version).ok_or_else(|| {
|
||||
eco_format!(
|
||||
"{} is not compatible with {}",
|
||||
version.as_str(),
|
||||
validator.as_str()
|
||||
)
|
||||
})?;
|
||||
let config = match (version, validator) {
|
||||
(Some(version), Some(validator)) => {
|
||||
Configuration::new_with(validator, version).ok_or_else(|| {
|
||||
eco_format!(
|
||||
"{} is not compatible with {}",
|
||||
version.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 })
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user