summaryrefslogtreecommitdiff
path: root/apps/pdfdraw.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/pdfdraw.c')
-rw-r--r--apps/pdfdraw.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/apps/pdfdraw.c b/apps/pdfdraw.c
index 790c7eaa..fd7cc57f 100644
--- a/apps/pdfdraw.c
+++ b/apps/pdfdraw.c
@@ -19,6 +19,7 @@ int showxml = 0;
int showtext = 0;
int showtime = 0;
int showmd5 = 0;
+int showoutline = 0;
int savealpha = 0;
int uselist = 1;
int alphabits = 8;
@@ -61,6 +62,7 @@ static void usage(void)
"\t-R -\trotate clockwise by given number of degrees\n"
"\t-G gamma\tgamma correct output\n"
"\t-I\tinvert output\n"
+ "\t-l\tprint outline\n"
"\tpages\tcomma separated list of ranges\n");
exit(1);
}
@@ -305,6 +307,16 @@ static void drawrange(pdf_xref *xref, char *range)
}
}
+static void drawoutline(pdf_xref *xref)
+{
+ fz_outline *outline = pdf_load_outline(xref);
+ if (showoutline > 1)
+ fz_debug_outline_xml(outline, 0);
+ else
+ fz_debug_outline(outline, 0);
+ fz_free_outline(outline);
+}
+
int main(int argc, char **argv)
{
char *password = "";
@@ -315,7 +327,7 @@ int main(int argc, char **argv)
int c;
fz_context *ctx;
- while ((c = fz_getopt(argc, argv, "o:p:r:R:Aab:dgmtx5G:I")) != -1)
+ while ((c = fz_getopt(argc, argv, "lo:p:r:R:Aab:dgmtx5G:I")) != -1)
{
switch (c)
{
@@ -326,6 +338,7 @@ int main(int argc, char **argv)
case 'A': accelerate = 0; break;
case 'a': savealpha = 1; break;
case 'b': alphabits = atoi(fz_optarg); break;
+ case 'l': showoutline++; break;
case 'm': showtime++; break;
case 't': showtext++; break;
case 'x': showxml++; break;
@@ -343,7 +356,7 @@ int main(int argc, char **argv)
if (fz_optind == argc)
usage();
- if (!showtext && !showxml && !showtime && !showmd5 && !output)
+ if (!showtext && !showxml && !showtime && !showmd5 && !showoutline && !output)
{
printf("nothing to do\n");
exit(0);
@@ -406,10 +419,16 @@ int main(int argc, char **argv)
if (showxml)
printf("<document name=\"%s\">\n", filename);
- if (fz_optind == argc || !isrange(argv[fz_optind]))
- drawrange(xref, "1-");
- if (fz_optind < argc && isrange(argv[fz_optind]))
- drawrange(xref, argv[fz_optind++]);
+ if (showoutline)
+ drawoutline(xref);
+
+ if (showtext || showxml || showtime || showmd5 || output)
+ {
+ if (fz_optind == argc || !isrange(argv[fz_optind]))
+ drawrange(xref, "1-");
+ if (fz_optind < argc && isrange(argv[fz_optind]))
+ drawrange(xref, argv[fz_optind++]);
+ }
if (showxml)
printf("</document>\n");