Check that features required by UA-1 are available in the current PDF version#278
Check that features required by UA-1 are available in the current PDF version#278reknih wants to merge 1 commit intoLaurenzV:mainfrom
Conversation
|
I guess I'm fine if it makes sense, but then it seems weird to me why they would say it works with all versions. |
|
Does not block Typst 0.14. |
|
First, there is the
This key was introduced in PDF 1.6. Of course, its default value is The This clause says that when headers or footers are present, the appropriate subtype must be used (introduced with PDF 1.7). If a document does not contain these, we can export it without issues. However, if it does (a page number is enough to trigger this in Typst), 1.7 it is. Hence, I see the following alternatives:
|
Are you sure? I just tried exporting a 1.4 document with Typst without the |
Hmm, unless there really are validators that trip up in this case, I don't really see why we should forbid this. If certain attributes are only permitted starting from a specific PDF version, then just omitting it seems fine to me. The PDF is still accessible after all, just with a little less information. So since the UA-1 specification explicitly mentions that versions prior to 1.7 are also permissible, I wouldn't consider this as an issue. Maybe worth asking for clarification in https://github.com/pdf-association/pdf-issues? |
|
Alright, I gave it a few checks:
I would like to redo and rename the PR to raise validation errors in these cases:
That way, documents not using these features can still output compliant UA-1 files and we make sure not to write invalid files. |
09491e8 to
0209a10
Compare
0209a10 to
4263e43
Compare
|
After thinking a bit more about this a bit more, I think the best thing to do is to simply only allow PDF/UA-1 with 1.7, even if in theory lower versions should be supported, as previously suggested. Any objections against this? @reknih @laurmaedje If not I'll open a PR for this. |
|
I'd be curious to know where the change of mind comes from: You have rightly asserted above that some files from older versions comply with UA-1. IMO raising a validation error only if the user requests a feature that is not possible with the Validator / PDF version tuple is elegant. Are you concerned about this behavior being unintuitive to users, difficult to document, or to maintain? |
LaurenzV
left a comment
There was a problem hiding this comment.
Overall LGTM, with comments addressed (and rebased onto newest main).
| assert_eq!( | ||
| document.finish(), | ||
| Err(KrillaError::Validation(vec

This PR checks that three features are available by the current PDF version in circumstances in which PDF/UA-1 requires them. If they are needed but unavailable, a validation error is raised.
An earlier implementation of this PR just forbid export to these lower versions entirely.