summaryrefslogtreecommitdiff
path: root/test/x11pdf.c
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2004-12-08 15:06:07 +0100
committerTor Andersson <tor@ghostscript.com>2004-12-08 15:06:07 +0100
commit5537c50d225b8521a043859f9de4057d271cac97 (patch)
treea3bf8962f522f3e398dcd99eb3452e913127bbce /test/x11pdf.c
parent576f0af8fbeb49f6e813d06379ed8b0db07ea271 (diff)
downloadmupdf-5537c50d225b8521a043859f9de4057d271cac97.tar.xz
seek/tell for openbuffer. path clip cloned too early.
Diffstat (limited to 'test/x11pdf.c')
-rw-r--r--test/x11pdf.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/test/x11pdf.c b/test/x11pdf.c
index 5dbfb506..6e38071f 100644
--- a/test/x11pdf.c
+++ b/test/x11pdf.c
@@ -48,7 +48,10 @@ static fz_pixmap *image;
void usage()
{
- fprintf(stderr, "usage: x11pdf [-u password] file.pdf\n");
+ fprintf(stderr, "usage: x11pdf [-b] [-pzr page/zoom/rotate] [-u password] file.pdf\n");
+ fprintf(stderr,
+"\n"
+ );
exit(1);
}
@@ -200,7 +203,13 @@ static void pdfopen(char *filename, char *password)
error = pdf_openpdf(&xref, filename);
if (error)
- fz_abort(error);
+ {
+ fz_warn(error->msg);
+ printf("trying to repair...\n");
+ error = pdf_repairpdf(&xref, filename);
+ if (error)
+ fz_abort(error);
+ }
error = pdf_decryptpdf(xref);
if (error)
@@ -486,12 +495,14 @@ int main(int argc, char **argv)
char *filename;
int c;
+ int benchmark = 0;
char *password = "";
- while ((c = getopt(argc, argv, "z:r:p:u:")) != -1)
+ while ((c = getopt(argc, argv, "bz:r:p:u:")) != -1)
{
switch (c)
{
+ case 'b': ++benchmark; break;
case 'u': password = optarg; break;
case 'p': pageno = atoi(optarg); break;
case 'z': zoom = atof(optarg); break;
@@ -512,13 +523,16 @@ int main(int argc, char **argv)
pdfopen(filename, password);
showpage();
-#ifdef RUNFAST
- while (pageno < count)
+ if (benchmark)
{
- pageno ++;
- showpage();
+ while (pageno < count)
+ {
+ pageno ++;
+ showpage();
+ }
+ return 0;
}
-#else
+
while (1)
{
int len;
@@ -548,7 +562,6 @@ int main(int argc, char **argv)
break;
}
}
-#endif
pdf_closepdf(xref);