Merge pull request #431 from kkujala/master

Fix xref bug.
This commit is contained in:
notmasteryet 2011-09-03 12:41:00 -07:00
commit bdfba05779

6
pdf.js
View File

@ -3546,7 +3546,7 @@ var Catalog = (function() {
} }
}, },
get destinations() { get destinations() {
function fetchDestination(ref) { function fetchDestination(xref, ref) {
var dest = xref.fetchIfRef(ref); var dest = xref.fetchIfRef(ref);
return IsDict(dest) ? dest.get('D') : dest; return IsDict(dest) ? dest.get('D') : dest;
} }
@ -3564,7 +3564,7 @@ var Catalog = (function() {
obj = xref.fetchIfRef(nameDictionaryRef); obj = xref.fetchIfRef(nameDictionaryRef);
obj.forEach(function(key, value) { obj.forEach(function(key, value) {
if (!value) return; if (!value) return;
dests[key] = fetchDestination(value); dests[key] = fetchDestination(xref, value);
}); });
} }
if (nameTreeRef) { if (nameTreeRef) {
@ -3588,7 +3588,7 @@ var Catalog = (function() {
} }
var names = obj.get('Names'); var names = obj.get('Names');
for (i = 0, n = names.length; i < n; i += 2) { for (i = 0, n = names.length; i < n; i += 2) {
dests[names[i]] = fetchDestination(names[i + 1]); dests[names[i]] = fetchDestination(xref, names[i + 1]);
} }
} }
} }