Closed sLe1tner closed 8 years ago
I think I found the issue... but I left the Rubocop on, so all the code got beautified and it's hard to see the little change I made...
The change was made here.
The code before was:
while (pos = should_resolve.pop)
and now:
while should_resolve.any?
pos = should_resolve.pop
This meant than nil
values would cause the data processing to stop in the middle. nil
values were introduced when nested name dictionaries existed because of the following code:
elsif pos.is_a? Hash
pos = pos[:referenced_object] || pos
next if resolved.include?(pos.object_id)
should_resolve << pos[:Kids]
should_resolve << pos[:Names]
end
which now looks like this:
elsif pos.is_a? Hash
pos = pos[:referenced_object] || pos
next if resolved.include?(pos.object_id)
should_resolve << pos[:Kids] if pos[:Kids]
should_resolve << pos[:Names] if pos[:Names]
end
However, I tested this only with the some of examples you gave me, but I'm a bit third from opening the PDF source files and skipping my launch break.
Could you see if there's anything else we need to update before we declare this as working and announce the feature in the CHANGELOG? - I already announced it in the CHANGELOG, so we better have it working :-)
Sweet, all the test cases I had work with the changes you made! :+1:
🎉
Tested, (fixed a minor issue) and released - woohooo 👍
I was hoping that the problem was resolved, but after going through the latest releases, I noticed that it still persists. From what I can tell, it happens when a PDF contains many named destination links. I used the following code:
Now, depending on the order in which I add them, I get different results:
results in all the links from the first PDF (b_pdf) working, but some of the second PDF (c_pdf) are not working:
However.. If I do it in the opposite order:
This way, none of the here first PDF (c_pdf) are working, but all the links from the other PDF (b_pdf) are still working fine.
If I use
b_pdf
alone:all the named destinations are fine. However - however.. In the code generating the
b_pdf
, I use a loop that runs for 19 iterations to generate a few named destinations:if I change the
19
to20
, which results in the code generatingb_pdf
like this:and again only use this PDF:
none of the named destinations are working.
Same if I use c_pdf only:
none of the named destinations are working. And same here, if I change the amount of named destination links generated in
c_pdf
from27
to19
, all of them work (they don't work if it's20
):PS: I used release v0.2.26. Don't mind the weird unicode characters in the links, I was just making sure that the problem isn't caused by special characters. The behaviour stays the same without them.