-
-
Notifications
You must be signed in to change notification settings - Fork 480
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
outline tree validation #626
Comments
A quick question - while your test showed that this doesn't trigger the error, the standard states (in table 150) that the Count value cannot be negative: "(Required if the document has any open outline entries) Total number of visible outline items at all levels of the outline. The value cannot be negative. This entry shall be omitted if there are no open outline items |
Count exists in 2 places in outlines (sorry if my original report was unclear as to which Count I was referring to!):
In the Outline Dictonary PDF says "Total number of visible outline items at all levels of the outline. The value cannot be negative. However in Outline Item Dictionaries, an algorithm is given that can result in a negative value (I guess technically it is no longer strictly a count) - the text ends with "If the outline item is closed, Count is negative and its absolute value is the number of descendants that would be visible if the outline item were opened." |
I have a problem with the defnition of "Count" for outline item dicts. ISO/DIS 32000-2:2020(E) states: It is unclear to me how to validate a negative "Count". Are we talking about the number of immediate descendents that may be visible or the maximum including any derived descendents thay may be visible eg. when the whole outline hierarchy for a node is expanded? |
The Adobe PDF 1.3 has a slightly clearer explanation:
so it covers all descendants, but you need to take into account the open/closed-ness of those descendants. This is consistent across all Counts in outlines. |
OK - So if I have an open outline tree in my viewer and close one intermediary node, then PDF just wants to store the negated number of visible descendents and multiplies the current Count by -1. That way next time I open the file and click on that outline item to open it the open/closedness from before the collapsing gets recalled. Please correct me if I am wrong, ..seems like a negative Count has to be the negative counterpart of the result of the recursion needed to calculate the number of visible descendents in the first place. |
This is fixed with latest commit. |
Command:
pdfcpu validate --mode=strict -v outline-test.pdf
for attached PDF outline-test.pdf
results in validation failure message:
Fatal: pdfcpu: validateOutlineTree: corrupted child list 11 <> 14
from:
when using:
The internal PDF is shown here:
I'm not understanding the failure message, but I do not believe there is anything wrong with the outline tree as specified by obj 11, obj 13 or obj 14.
Also (separately): I don't think the validation code is checking the absolute value of Count vs the number of entries at each level. If I change it to
-9
or99
there is no validation failure either in relaxed or strict mode.The text was updated successfully, but these errors were encountered: