summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Kennard <glenn.kennard@gmail.com>2005-05-08 19:00:54 +0200
committerGlenn Kennard <glenn.kennard@gmail.com>2005-05-08 19:00:54 +0200
commita5f974df7fa0aac1cf22c5e1be3fd06de820a41a (patch)
tree5fb94eaa3398a28feed3142dbb1fbd662e1a5e15
parentddef3982479e4e4ffa6da745a77177193f496898 (diff)
downloadmupdf-a5f974df7fa0aac1cf22c5e1be3fd06de820a41a.tar.xz
x11pdf zoom and page number command line options
-rw-r--r--apps/common/pdfapp.c6
-rw-r--r--apps/unix/x11pdf.c10
2 files changed, 12 insertions, 4 deletions
diff --git a/apps/common/pdfapp.c b/apps/common/pdfapp.c
index d87268c1..d7bed118 100644
--- a/apps/common/pdfapp.c
+++ b/apps/common/pdfapp.c
@@ -169,8 +169,10 @@ void pdfapp_open(pdfapp_t *app, char *filename)
*/
app->shrinkwrap = 1;
- app->pageno = 1;
- app->zoom = 1.0;
+ if (app->pageno < 1)
+ app->pageno = 1;
+ if (app->zoom <= 0.0)
+ app->zoom = 1.0;
app->rotate = 0;
app->panx = 0;
app->pany = 0;
diff --git a/apps/unix/x11pdf.c b/apps/unix/x11pdf.c
index 3dfddcad..0df360db 100644
--- a/apps/unix/x11pdf.c
+++ b/apps/unix/x11pdf.c
@@ -392,7 +392,7 @@ void onmouse(int x, int y, int btn, int state)
void usage(void)
{
- fprintf(stderr, "usage: ghostpdf [-d password] file.pdf\n");
+ fprintf(stderr, "usage: ghostpdf [-d password] [-z zoom] [-p pagenumber] file.pdf\n");
exit(1);
}
@@ -405,12 +405,16 @@ int main(int argc, char **argv)
KeySym keysym;
int oldx = 0;
int oldy = 0;
+ double zoom = 1.0;
+ int pageno = 1;
- while ((c = getopt(argc, argv, "d:")) != -1)
+ while ((c = getopt(argc, argv, "dzp:")) != -1)
{
switch (c)
{
case 'd': password = optarg; break;
+ case 'z': zoom = atof(optarg); break;
+ case 'p': pageno = atoi(optarg); break;
default: usage();
}
}
@@ -428,6 +432,8 @@ int main(int argc, char **argv)
pdfapp_init(&gapp);
gapp.scrw = DisplayWidth(xdpy, xscr);
gapp.scrh = DisplayHeight(xdpy, xscr);
+ gapp.zoom = zoom;
+ gapp.pageno = pageno;
pdfapp_open(&gapp, filename);