diff options
author | Robin Watts <robin.watts@artifex.com> | 2015-04-02 19:27:51 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2015-04-06 19:30:54 +0100 |
commit | 95d746f13a86d914dd88310c994b27b08db4bb5b (patch) | |
tree | 8e501f2dea42248742ae9ee4e4dbad29848ab314 | |
parent | 5f76f7a85e9590e9b3db2392806010b76ad633b6 (diff) | |
download | mupdf-95d746f13a86d914dd88310c994b27b08db4bb5b.tar.xz |
Fix oddity with pdfinfo
If pdfinfo is invoked as:
mutool info file.pdf 1,2,3
then it will show the items found on page 1, then the items found on
pages 1 and 2, then the items shown on pages 1,2 and 3.
Fix this by clearing the data after each show operation.
-rw-r--r-- | source/tools/pdfinfo.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source/tools/pdfinfo.c b/source/tools/pdfinfo.c index a3a7ba24..cc18a1e1 100644 --- a/source/tools/pdfinfo.c +++ b/source/tools/pdfinfo.c @@ -87,14 +87,9 @@ typedef struct globals_s int psobjs; } globals; -static void closexref(fz_context *ctx, globals *glo) +static void clearinfo(fz_context *ctx, globals *glo) { int i; - if (glo->doc) - { - pdf_close_document(ctx, glo->doc); - glo->doc = NULL; - } if (glo->dim) { @@ -148,6 +143,17 @@ static void closexref(fz_context *ctx, globals *glo) } } +static void closexref(fz_context *ctx, globals *glo) +{ + if (glo->doc) + { + pdf_close_document(ctx, glo->doc); + glo->doc = NULL; + } + + clearinfo(ctx, glo); +} + static void infousage(void) { @@ -954,6 +960,7 @@ showinfo(fz_context *ctx, globals *glo, char *filename, int show, char *pagelist fz_printf(ctx, out, "Page %d:\n", page); printinfo(ctx, glo, filename, show, page); fz_printf(ctx, out, "\n"); + clearinfo(ctx, glo); } } |