summaryrefslogtreecommitdiff
path: root/utils/pdfimages.cc
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2013-08-18 17:29:00 +0930
committerAdrian Johnson <ajohnson@redneon.com>2013-08-26 06:40:34 +0930
commit2021c8ffcb36432049c4305e85ced2ae139086f3 (patch)
treef06fa6940478994650f52f110b246fcd31059d08 /utils/pdfimages.cc
parent8f466775c77b09a7114c688004317e6db05bcd3f (diff)
pdfimages: add support for png and tiff output
Diffstat (limited to 'utils/pdfimages.cc')
-rw-r--r--utils/pdfimages.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/utils/pdfimages.cc b/utils/pdfimages.cc
index 7b6cad0d..fee7b755 100644
--- a/utils/pdfimages.cc
+++ b/utils/pdfimages.cc
@@ -50,6 +50,8 @@
static int firstPage = 1;
static int lastPage = 0;
static GBool listImages = gFalse;
+static GBool enablePNG = gFalse;
+static GBool enableTiff = gFalse;
static GBool dumpJPEG = gFalse;
static GBool pageNames = gFalse;
static char ownerPassword[33] = "\001";
@@ -63,6 +65,14 @@ static const ArgDesc argDesc[] = {
"first page to convert"},
{"-l", argInt, &lastPage, 0,
"last page to convert"},
+#if ENABLE_LIBPNG
+ {"-png", argFlag, &enablePNG, 0,
+ "change the default output format to PNG"},
+#endif
+#if ENABLE_LIBTIFF
+ {"-tiff", argFlag, &enableTiff, 0,
+ "change the default output format to TIFF"},
+#endif
{"-j", argFlag, &dumpJPEG, 0,
"write JPEG images as JPEG files"},
{"-list", argFlag, &listImages, 0,
@@ -168,10 +178,13 @@ int main(int argc, char *argv[]) {
lastPage = doc->getNumPages();
// write image files
- imgOut = new ImageOutputDev(imgRoot, pageNames, dumpJPEG, listImages);
+ imgOut = new ImageOutputDev(imgRoot, pageNames, listImages);
if (imgOut->isOk()) {
- doc->displayPages(imgOut, firstPage, lastPage, 72, 72, 0,
- gTrue, gFalse, gFalse);
+ imgOut->enablePNG(enablePNG);
+ imgOut->enableTiff(enableTiff);
+ imgOut->enableJpeg(dumpJPEG);
+ doc->displayPages(imgOut, firstPage, lastPage, 72, 72, 0,
+ gTrue, gFalse, gFalse);
}
delete imgOut;