summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@hotmail.com>2008-04-19 23:28:24 +0200
committerSebastian Rasmussen <sebras@hotmail.com>2008-04-19 23:28:24 +0200
commit7ce3c60b89c2498acb14a7e81f73ebb3b68e7387 (patch)
treeba57fb01214e3f1a1564a1c63640c81c4a48ee22 /apps
parentdfcb3f8b222240f1da9d5a5d57a326ac7dfda39c (diff)
downloadmupdf-7ce3c60b89c2498acb14a7e81f73ebb3b68e7387.tar.xz
Properly parse catalog dictionary, information dictionary, name dictionary and outline dictionary when doing pdftool operations.
Diffstat (limited to 'apps')
-rw-r--r--apps/pdftool.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/apps/pdftool.c b/apps/pdftool.c
index 170173e7..2d2af9fb 100644
--- a/apps/pdftool.c
+++ b/apps/pdftool.c
@@ -23,6 +23,7 @@
char *srcname = "(null)";
pdf_xref *src = nil;
+pdf_outline *srcoutline = nil;
pdf_pagetree *srcpages = nil;
void die(fz_error *eo)
@@ -58,6 +59,7 @@ void closesrc(void)
void opensrc(char *filename, char *password, int loadpages)
{
fz_error *error;
+ fz_obj *obj;
closesrc();
@@ -94,6 +96,31 @@ void opensrc(char *filename, char *password, int loadpages)
if (error)
die(error);
}
+
+ /* TODO: move into mupdf lib, see pdfapp_open in pdfapp.c */
+ obj = fz_dictgets(src->trailer, "Root");
+ if (!obj)
+ die(error);
+
+ error = pdf_loadindirect(&src->root, src, obj);
+ if (error)
+ die(error);
+
+ obj = fz_dictgets(src->trailer, "Info");
+ if (obj)
+ {
+ error = pdf_loadindirect(&src->info, src, obj);
+ if (error)
+ die(error);
+ }
+
+ error = pdf_loadnametrees(src);
+ if (error)
+ die(error);
+
+ error = pdf_loadoutline(&srcoutline, src);
+ if (error)
+ die(error);
}
void preloadobjstms(void)