Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling of inline images with both abbreviated and full keys #3

Closed
petervwyatt opened this issue Dec 20, 2020 · 5 comments
Closed
Labels
ISO approved Resolved issue approved by ISO

Comments

@petervwyatt
Copy link
Member

Clause 8.9.7 Inline images, Table 91 establishes that many keys in an inline image header pseudo-dictionary can be abbreviations of longer named keys in an Image XObject. But what happens if an inline image has both the full key name and its abbreviation (and they have different values)?

Is this a "duplicate key" and an error? In which case the clause 7.3.7 wording "Multiple entries in the same dictionary shall not have the same key" is inadequate as they are not actually the same key names (just logically/semantically).

We do NOT want to have "first key in dict" / "last key in dict" logic as that would also clearly contradict everywhere else in PDF and clause 7.3.7 "That ordering shall be ignored."

Or does one form of the key take precedence? e.g. long-form over abbreviation? Or vice-versa?

Or do we call this case out explicitly as an error in 8.9.7 and state that the inline image "shall" be skipped in any rendered output.

My preference is for some type of "resolve and continue processing" handling so that the inline image might hopefully get painted.

@petervwyatt petervwyatt added the bug Something isn't working label Dec 20, 2020
@lrosenthol
Copy link
Collaborator

Looking at the implementation of a well known PDF processor...

We always look for the short form/abbreviation first. If not present, then we look for the full name.

@petervwyatt petervwyatt added the proposed solution Proposed solution is ready for review label Jan 4, 2021
@petervwyatt
Copy link
Member Author

Proposed solution: prioritize abbreviated keys first, then use full key names.

Proposed additional sentence: "In the situation where both an abbreviated key name and the corresponding full key name from Table 91 are present, the abbreviated key name shall take precedence."

Appended to this paragraph "The key-value pairs appearing between the BI and ID operators (as listed in "Table 91 — Entries in an inline image object") are analogous to their respective key-value pairs in an image XObject dictionary (see "Table 87 — Additional entries specific to an image dictionary") or a stream dictionary (see "Table 5 — Entries common to all stream dictionaries"). For convenience, the abbreviations shown in "Table 91 — Entries in an inline image object" and "Table 92 — Additional abbreviations in an inline image object" may be used in place of the full names. Entries other than those listed shall be ignored."

@MPBailey
Copy link
Collaborator

+1 for the proposal.

But every time I re-read a section I find some more niggles. So here are a few minor tweaks in the related text; feel free to split into separate stories if you think these are worth following up:

• There a striking contrast between the text in the 1st para after Table 90: “Unless the image uses ASCIIHexDecode or ASCII85Decode as one of its filters” and in Note 2: “if the final or only filter is ASCIIHexDecode or ASCII85Decode”. Shouldn’t the first of those also talk about “if the final or only filter” rather than ASCII~ being “one of its filters”? I realise you’d need to have done something very odd if you’re using ASCII~ and something else, and the ASCII~ is not last, but …

• Note 1 carefully mentions both Length and L, but Note 2 only mentions L, which seems inconsistent. Note 2 should identify both as well.

• Note 3 says that various colour space names don’t refer to resources in the ColorSpace subdictionary; all well and good. But it starts by saying that they identify the corresponding colour spaces directly. Hmmm, don’t DefaultGray, DefaultRGB and DefaultCMYK kick in here?

@petervwyatt
Copy link
Member Author

Could you please make a new Issue for your 2 new points above?
This issue is about the behaviour for logically-duplicated-but-not-actually-duplicated keys in inline images, whereas your new issues are about special handling rules for ASCII* filters in inline images. Same clause but different core issues. Thanks.

@MPBailey
Copy link
Collaborator

Done, thanks

@petervwyatt petervwyatt added ISO submitted Resolved issue submitted to ISO for approval and removed bug Something isn't working proposed solution Proposed solution is ready for review labels Dec 6, 2021
@petervwyatt petervwyatt added this to the ISO Submission Feb 2022 milestone Dec 6, 2021
@petervwyatt petervwyatt added ISO approved Resolved issue approved by ISO and removed ISO submitted Resolved issue submitted to ISO for approval labels Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ISO approved Resolved issue approved by ISO
Projects
None yet
Development

No branches or pull requests

4 participants