mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
Merge pull request #18421 from Snuffleupagus/bug-1907000
Allow e.g. /FitH destinations without additional parameter (bug 1907000)
This commit is contained in:
commit
b56e4209a9
5 changed files with 248 additions and 2 deletions
|
@ -78,7 +78,7 @@ function isValidExplicitDest(dest) {
|
||||||
case "FitBH":
|
case "FitBH":
|
||||||
case "FitV":
|
case "FitV":
|
||||||
case "FitBV":
|
case "FitBV":
|
||||||
if (args.length !== 1) {
|
if (args.length > 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
|
@ -13,6 +13,7 @@
|
||||||
!issue1155r.pdf
|
!issue1155r.pdf
|
||||||
!issue2017r.pdf
|
!issue2017r.pdf
|
||||||
!bug1727053.pdf
|
!bug1727053.pdf
|
||||||
|
!bug1907000_reduced.pdf
|
||||||
!issue11913.pdf
|
!issue11913.pdf
|
||||||
!issue2391-1.pdf
|
!issue2391-1.pdf
|
||||||
!issue2391-2.pdf
|
!issue2391-2.pdf
|
||||||
|
|
202
test/pdfs/bug1907000_reduced.pdf
Normal file
202
test/pdfs/bug1907000_reduced.pdf
Normal file
File diff suppressed because one or more lines are too long
|
@ -1901,6 +1901,49 @@ describe("api", function () {
|
||||||
await loadingTask.destroy();
|
await loadingTask.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("gets outline, with /FitH destinations that lack coordinate parameter (bug 1907000)", async function () {
|
||||||
|
const loadingTask = getDocument(
|
||||||
|
buildGetDocumentParams("bug1907000_reduced.pdf")
|
||||||
|
);
|
||||||
|
const pdfDoc = await loadingTask.promise;
|
||||||
|
const outline = await pdfDoc.getOutline();
|
||||||
|
|
||||||
|
expect(outline).toEqual([
|
||||||
|
{
|
||||||
|
action: null,
|
||||||
|
attachment: undefined,
|
||||||
|
dest: [{ num: 14, gen: 0 }, { name: "FitH" }],
|
||||||
|
url: null,
|
||||||
|
unsafeUrl: undefined,
|
||||||
|
newWindow: undefined,
|
||||||
|
setOCGState: undefined,
|
||||||
|
title: "Page 1",
|
||||||
|
color: new Uint8ClampedArray([0, 0, 0]),
|
||||||
|
count: undefined,
|
||||||
|
bold: false,
|
||||||
|
italic: false,
|
||||||
|
items: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: null,
|
||||||
|
attachment: undefined,
|
||||||
|
dest: [{ num: 13, gen: 0 }, { name: "FitH" }],
|
||||||
|
url: null,
|
||||||
|
unsafeUrl: undefined,
|
||||||
|
newWindow: undefined,
|
||||||
|
setOCGState: undefined,
|
||||||
|
title: "Page 2",
|
||||||
|
color: new Uint8ClampedArray([0, 0, 0]),
|
||||||
|
count: undefined,
|
||||||
|
bold: false,
|
||||||
|
italic: false,
|
||||||
|
items: [],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
await loadingTask.destroy();
|
||||||
|
});
|
||||||
|
|
||||||
it("gets non-existent permissions", async function () {
|
it("gets non-existent permissions", async function () {
|
||||||
const permissions = await pdfDocument.getPermissions();
|
const permissions = await pdfDocument.getPermissions();
|
||||||
expect(permissions).toEqual(null);
|
expect(permissions).toEqual(null);
|
||||||
|
|
|
@ -519,7 +519,7 @@ class PDFLinkService {
|
||||||
case "FitBH":
|
case "FitBH":
|
||||||
case "FitV":
|
case "FitV":
|
||||||
case "FitBV":
|
case "FitBV":
|
||||||
if (args.length !== 1) {
|
if (args.length > 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue