diff options
author | Robin Watts <robin.watts@artifex.com> | 2015-03-25 17:51:47 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2015-03-25 18:22:48 +0000 |
commit | 0bbafc586f1431d4a0059bb9c90981624d67e469 (patch) | |
tree | 80d3a3e32822eac62781a1954010c926b1aadf48 | |
parent | fd2ca50b85bd6aa2e2fe474dc1b9f6d5a6ffaa32 (diff) | |
download | mupdf-0bbafc586f1431d4a0059bb9c90981624d67e469.tar.xz |
Bug 695878: Add entry to fz_outline to indicate if outline entry is open
Adopt a (trivially modified) patch provided by Simon Reinhardt.
When loading pdf outlines, if the 'Count' field is positive, the outline
entry should be considered open.
-rw-r--r-- | include/mupdf/fitz/outline.h | 1 | ||||
-rw-r--r-- | source/pdf/pdf-outline.c | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/include/mupdf/fitz/outline.h b/include/mupdf/fitz/outline.h index 6a3ca81a..f0b2cc42 100644 --- a/include/mupdf/fitz/outline.h +++ b/include/mupdf/fitz/outline.h @@ -34,6 +34,7 @@ struct fz_outline_s fz_link_dest dest; fz_outline *next; fz_outline *down; + int is_open; }; /* diff --git a/source/pdf/pdf-outline.c b/source/pdf/pdf-outline.c index 8f83fdf9..e8635551 100644 --- a/source/pdf/pdf-outline.c +++ b/source/pdf/pdf-outline.c @@ -23,6 +23,7 @@ pdf_load_outline_imp(fz_context *ctx, pdf_document *doc, pdf_obj *dict) node->dest.kind = FZ_LINK_NONE; node->down = NULL; node->next = NULL; + node->is_open = 0; *prev = node; prev = &node->next; @@ -37,8 +38,14 @@ pdf_load_outline_imp(fz_context *ctx, pdf_document *doc, pdf_obj *dict) obj = pdf_dict_get(ctx, dict, PDF_NAME_First); if (obj) + { node->down = pdf_load_outline_imp(ctx, doc, obj); + obj = pdf_dict_gets(ctx, dict, PDF_NAME_Count); + if (pdf_to_int(ctx, obj) > 0) + node->is_open = 1; + } + dict = pdf_dict_get(ctx, dict, PDF_NAME_Next); } } |