1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Add support for outline items, in the default viewer, which default to collapsed when the outline is built

The PDF specification supports this feature, which is commonly used in large/long documents (such as the spec itself), and it seems reasonably straightforward to implement; see https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf#G11.2095911
This commit is contained in:
Jonas Jenwald 2019-06-07 12:19:28 +02:00
parent 63014eb897
commit 26bc630e19
3 changed files with 13 additions and 7 deletions

View file

@ -144,6 +144,7 @@ class Catalog {
const title = outlineDict.get('Title');
const flags = outlineDict.get('F') || 0;
const color = outlineDict.getArray('C');
const count = outlineDict.get('Count');
let rgbColor = blackColor;
// We only need to parse the color when it's valid, and non-default.
@ -159,7 +160,7 @@ class Catalog {
newWindow: data.newWindow,
title: stringToPDFString(title),
color: rgbColor,
count: outlineDict.get('Count'),
count: Number.isInteger(count) ? count : undefined,
bold: !!(flags & 2),
italic: !!(flags & 1),
items: [],

View file

@ -715,6 +715,7 @@ class PDFDocumentProxy {
* bold: boolean,
* italic: boolean,
* color: rgb Uint8ClampedArray,
* count: integer or undefined,
* dest: dest obj,
* url: string,
* items: array of more items like this