summaryrefslogtreecommitdiff
path: root/source/tools/pdfshow.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-04-26 14:30:32 +0200
committerTor Andersson <tor.andersson@artifex.com>2017-04-27 15:12:03 +0200
commitcabf4489896a2a978361eb6e1df4b4aef81193f4 (patch)
tree42c304158abc24dcec776b1a38f14f4db6eaa95f /source/tools/pdfshow.c
parent2208034206c6085fa07063bcc6fdc834d6472912 (diff)
downloadmupdf-cabf4489896a2a978361eb6e1df4b4aef81193f4.tar.xz
Move fz_outline and pdf_xref debug printing to pdfshow.c
That's where it's actually being used.
Diffstat (limited to 'source/tools/pdfshow.c')
-rw-r--r--source/tools/pdfshow.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/source/tools/pdfshow.c b/source/tools/pdfshow.c
index 71d2b4ca..0ae0fce7 100644
--- a/source/tools/pdfshow.c
+++ b/source/tools/pdfshow.c
@@ -48,6 +48,24 @@ static void showencrypt(void)
fz_write_printf(ctx, out, "\n");
}
+void
+pdf_print_xref(fz_context *ctx, pdf_document *doc)
+{
+ int i;
+ int xref_len = pdf_xref_len(ctx, doc);
+ printf("xref\n0 %d\n", xref_len);
+ for (i = 0; i < xref_len; i++)
+ {
+ pdf_xref_entry *entry = pdf_get_xref_entry(ctx, doc, i);
+ printf("%05d: %010d %05d %c (stm_ofs=%d; stm_buf=%p)\n", i,
+ (int)entry->ofs,
+ entry->gen,
+ entry->type ? entry->type : '-',
+ (int)entry->stm_ofs,
+ entry->stm_buf);
+ }
+}
+
static void showxref(void)
{
if (!doc)
@@ -195,6 +213,21 @@ static void showgrep(char *filename)
fz_write_printf(ctx, out, "\n");
}
+static void
+fz_print_outline(fz_context *ctx, fz_output *out, fz_outline *outline, int level)
+{
+ int i;
+ while (outline)
+ {
+ for (i = 0; i < level; i++)
+ fz_write_printf(ctx, out, "\t");
+ fz_write_printf(ctx, out, "%s\t%s\n", outline->title, outline->uri);
+ if (outline->down)
+ fz_print_outline(ctx, out, outline->down, level + 1);
+ outline = outline->next;
+ }
+}
+
static void showoutline(void)
{
fz_outline *outline = fz_load_outline(ctx, (fz_document*)doc);
@@ -204,7 +237,7 @@ static void showoutline(void)
fz_try(ctx)
{
out = fz_stdout(ctx);
- fz_print_outline(ctx, out, outline);
+ fz_print_outline(ctx, out, outline, 0);
}
fz_always(ctx)
{