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

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Dec 27 22:33:21 UTC 2019


 utils/pdftoppm.1  |    3 +++
 utils/pdftoppm.cc |   10 +++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 7de14f43562f4064d7b4cf1264e6cc8a89e6f4f2
Author: Sébastien Berthier <s.berthier at bee-buzziness.com>
Date:   Tue Dec 24 10:09:02 2019 +0100

    pdftoppm: add -hide-annotations option

diff --git a/utils/pdftoppm.1 b/utils/pdftoppm.1
index 56808cd0..472f6f21 100644
--- a/utils/pdftoppm.1
+++ b/utils/pdftoppm.1
@@ -83,6 +83,9 @@ Specifies the size of crop square in pixels (sets W and H)
 .B \-cropbox
 Uses the crop box rather than media box when generating the files
 .TP
+.B \-hide-annotations
+Do not show annotations
+.TP
 .B \-mono
 Generate a monochrome PBM file (instead of a color PPM file).
 .TP
diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index 68006c5b..c21bb324 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -88,6 +88,7 @@ static int param_y = 0;
 static int param_w = 0;
 static int param_h = 0;
 static int sz = 0;
+static bool hideAnnotations = false;
 static bool useCropBox = false;
 static bool mono = false;
 static bool gray = false;
@@ -159,6 +160,8 @@ static const ArgDesc argDesc[] = {
    "size of crop square in pixels (sets W and H)"},
   {"-cropbox",argFlag,     &useCropBox,    0,
    "use the crop box rather than media box"},
+  {"-hide-annotations", argFlag,  &hideAnnotations,    0,
+   "do not show annotations"},
 
   {"-mono",   argFlag,     &mono,          0,
    "generate a monochrome PBM file"},
@@ -288,6 +291,10 @@ static bool parseJpegOptions()
   return true;
 }
 
+static auto annotDisplayDecideCbk = [](Annot *annot, void *user_data) {
+  return !hideAnnotations;
+};
+
 static void savePageSlice(PDFDoc *doc,
                    SplashOutputDev *splashOut, 
                    int pg, int x, int y, int w, int h, 
@@ -301,7 +308,8 @@ static void savePageSlice(PDFDoc *doc,
     pg, x_resolution, y_resolution, 
     0,
     !useCropBox, false, false,
-    x, y, w, h
+    x, y, w, h,
+    nullptr, nullptr, annotDisplayDecideCbk, nullptr
   );
 
   SplashBitmap *bitmap = splashOut->getBitmap();


More information about the poppler mailing list