[poppler] utils/pdftoppm.1 utils/pdftoppm.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 12 14:15:04 UTC 2021


 utils/pdftoppm.1  |    6 ++++++
 utils/pdftoppm.cc |    6 ++++++
 2 files changed, 12 insertions(+)

New commits:
commit 4d45cf37f3f74fdf6b02be73a051631abcf0e665
Author: Diogo Kollross <diogoko at gmail.com>
Date:   Fri Feb 12 14:15:03 2021 +0000

    pdftoppm: Add -progress option

diff --git a/utils/pdftoppm.1 b/utils/pdftoppm.1
index 2cd52b19..ddbe4d70 100644
--- a/utils/pdftoppm.1
+++ b/utils/pdftoppm.1
@@ -159,6 +159,12 @@ Specify the user password for the PDF file.
 .B \-q
 Don't print any messages or errors.
 .TP
+.B \-progress
+Print progress info as each page is generated.  Three space-separated
+fields are printed to STDERR: the number of the current page, the number
+of the last page that will be generated, and the path to the file
+written to.
+.TP
 .BI \-sep " char"
 Specify single character separator between name and page number, default - .
 .TP
diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index 9ad62fdd..0c886d40 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -137,6 +137,7 @@ static SplashThinLineMode thinLineMode = splashThinLineDefault;
 static int numberOfJobs = 1;
 #endif // UTILS_USE_PTHREADS
 static bool quiet = false;
+static bool progress = false;
 static bool printVersion = false;
 static bool printHelp = false;
 
@@ -199,6 +200,7 @@ static const ArgDesc argDesc[] = { { "-f", argInt, &firstPage, 0, "first page to
 #endif // UTILS_USE_PTHREADS
 
                                    { "-q", argFlag, &quiet, 0, "don't print any messages or errors" },
+                                   { "-progress", argFlag, &progress, 0, "print progress info" },
                                    { "-v", argFlag, &printVersion, 0, "print copyright and version info" },
                                    { "-h", argFlag, &printHelp, 0, "print usage information" },
                                    { "-help", argFlag, &printHelp, 0, "print usage information" },
@@ -323,6 +325,10 @@ static void savePageSlice(PDFDoc *doc, SplashOutputDev *splashOut, int pg, int x
             bitmap->writePNMFile(stdout);
         }
     }
+
+    if (progress) {
+        fprintf(stderr, "%d %d %s\n", pg, lastPage, ppmFile != nullptr ? ppmFile : "");
+    }
 }
 
 #ifdef UTILS_USE_PTHREADS


More information about the poppler mailing list