diff options
Diffstat (limited to 'Build/source/libs/xpdf/xpdf-src/xpdf/pdftoppm.cc')
-rw-r--r-- | Build/source/libs/xpdf/xpdf-src/xpdf/pdftoppm.cc | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/pdftoppm.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/pdftoppm.cc index 0b084b014e5..28861ef948b 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/pdftoppm.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/pdftoppm.cc @@ -26,6 +26,7 @@ #include "SplashBitmap.h" #include "Splash.h" #include "SplashOutputDev.h" +#include "Error.h" #include "config.h" static int firstPage = 1; @@ -42,6 +43,7 @@ static char antialiasStr[16] = ""; static char vectorAntialiasStr[16] = ""; static char ownerPassword[33] = ""; static char userPassword[33] = ""; +static GBool verbose = gFalse; static GBool quiet = gFalse; static char cfgFileName[256] = ""; static GBool printVersion = gFalse; @@ -76,6 +78,8 @@ static ArgDesc argDesc[] = { "owner password (for encrypted files)"}, {"-upw", argString, userPassword, sizeof(userPassword), "user password (for encrypted files)"}, + {"-verbose", argFlag, &verbose, 0, + "print per-page status information"}, {"-q", argFlag, &quiet, 0, "don't print any messages or errors"}, {"-cfg", argString, cfgFileName, sizeof(cfgFileName), @@ -101,7 +105,7 @@ int main(int argc, char *argv[]) { GString *ownerPW, *userPW; SplashColor paperColor; SplashOutputDev *splashOut; - GBool ok; + GBool ok, toStdout, printStatusInfo; int exitCode; int pg, n; const char *ext; @@ -147,6 +151,10 @@ int main(int argc, char *argv[]) { ppmRoot = argv[2]; // read config file + if (cfgFileName[0] && !pathIsFile(cfgFileName)) { + error(errConfig, -1, "Config file '{0:s}' doesn't exist or isn't a file", + cfgFileName); + } globalParams = new GlobalParams(cfgFileName); globalParams->setupBaseFonts(NULL); if (enableFreeTypeStr[0]) { @@ -164,6 +172,9 @@ int main(int argc, char *argv[]) { fprintf(stderr, "Bad '-aaVector' value on command line\n"); } } + if (verbose) { + globalParams->setPrintStatusInfo(verbose); + } if (quiet) { globalParams->setErrQuiet(quiet); } @@ -211,6 +222,10 @@ int main(int argc, char *argv[]) { } + // check for stdout; set up to print per-page status info + toStdout = !strcmp(ppmRoot, "-"); + printStatusInfo = !toStdout && globalParams->getPrintStatusInfo(); + // write PPM files if (mono) { paperColor[0] = 0xff; @@ -229,9 +244,14 @@ int main(int argc, char *argv[]) { } splashOut->startDoc(doc->getXRef()); for (pg = firstPage; pg <= lastPage; ++pg) { + if (printStatusInfo) { + fflush(stderr); + printf("[processing page %d]\n", pg); + fflush(stdout); + } doc->displayPage(splashOut, pg, resolution, resolution, rotate, gFalse, gTrue, gFalse); - if (!strcmp(ppmRoot, "-")) { + if (toStdout) { #ifdef _WIN32 _setmode(_fileno(stdout), _O_BINARY); #endif |