summaryrefslogtreecommitdiff
path: root/source/tools/pdfshow.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/tools/pdfshow.c')
-rw-r--r--source/tools/pdfshow.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/source/tools/pdfshow.c b/source/tools/pdfshow.c
index d084c080..10ed4405 100644
--- a/source/tools/pdfshow.c
+++ b/source/tools/pdfshow.c
@@ -14,7 +14,7 @@ static int showcolumn;
static void usage(void)
{
- fprintf(stderr, "usage: mutool show [options] file.pdf [grep] [xref] [trailer] [pages] [object numbers]\n");
+ fprintf(stderr, "usage: mutool show [options] file.pdf [grep] [xref] [trailer] [pages] [outline] [object numbers]\n");
fprintf(stderr, "\t-b\tprint streams as binary data\n");
fprintf(stderr, "\t-e\tprint encoded streams (don't decode)\n");
fprintf(stderr, "\t-p\tpassword\n");
@@ -190,6 +190,28 @@ static void showgrep(char *filename)
pdf_fprint_obj(ctx, out, pdf_trailer(ctx, doc), 1);
}
+static void showoutline(void)
+{
+ fz_outline *outline = fz_load_outline(ctx, (fz_document*)doc);
+ fz_output *out = NULL;
+
+ fz_var(out);
+ fz_try(ctx)
+ {
+ out = fz_new_output_with_file(ctx, stdout, 0);
+ fz_print_outline(ctx, out, outline);
+ }
+ fz_always(ctx)
+ {
+ fz_drop_output(ctx, out);
+ fz_drop_outline(ctx, outline);
+ }
+ fz_catch(ctx)
+ {
+ fz_rethrow(ctx);
+ }
+}
+
int pdfshow_main(int argc, char **argv)
{
char *password = NULL; /* don't throw errors if encrypted */
@@ -252,6 +274,7 @@ int pdfshow_main(int argc, char **argv)
case 'x': showxref(); break;
case 'p': showpagetree(); break;
case 'g': showgrep(filename); break;
+ case 'o': showoutline(); break;
default: showobject(atoi(argv[fz_optind]), 0); break;
}
fz_optind++;