Summary: | Link destinations incorrectly created upon missing coordinate | ||
---|---|---|---|
Product: | MuPDF | Reporter: | Sebastian Rasmussen <sebastian.rasmussen> |
Component: | mupdf | Assignee: | Sebastian Rasmussen <sebastian.rasmussen> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | master | ||
Hardware: | PC | ||
OS: | Linux | ||
URL: | https://github.com/ArtifexSoftware/mupdf.js/issues/89 | ||
Customer: | Word Size: | --- |
Description
Sebastian Rasmussen
2024-06-10 21:28:31 UTC
I have reproduce this in mutool run using a script:
var doc = Document.openDocument("doc.pdf");
print(doc);
var iter = doc.outlineIterator();
print(iter);
var dest = {
page: 10,
type: 'XYZ',
y: 200,
};
print(dest);
var ourrll = doc.formatLinkURI(dest);
print(ourrll);
var item = {
title: 'demo',
uri: ourrll,
open: false,
};
print(item);
var res = iter.insert(item);
print(res);
doc.save("out.pdf", "incremental");
res = null;
item = null;
ourrll = null;
dest = null;
iter = null;
doc = null;
gc();
After executing the script and looking at out.pdf:
$ mutool show out.pdf trailer.Root.Outlines.First
87 0 obj
<<
/Parent 3 0 R
/Title (demo)
/Dest [ 71 0 R /XYZ null null null ]
>>
endobj
Alright this clusters and pymupdfs well. Off to review, during which there are bound to be a few comments as my proposed code is not really nice. Maybe the fix should be _inside_ fz_transform_point_xy()? Indeed there was comments during review, thus this was fixed by commit 352234290008fdf093b3c396f375fdef6de91121 Author: Robin Watts <Robin.Watts@artifex.com> Date: Tue Jun 11 09:15:49 2024 +0100 Bug 707822: Take missing coordinates into account when creating link dest. Previously if either coordinate was NaN, then after transformation both coordinates would be NaN. But it is desired for given coordinates to be transformed while missing coordinates are kept at NaN. From an original patch by Sebastian. |