Read NumCopies viewer preference
Lookup for NumCopies viewer preference
in constructor of ViewerPreferences and make
it available via getNumCopies() method.
https://gitlab.freedesktop.org/poppler/poppler/issues/290
diff --git a/poppler/ViewerPreferences.cc b/poppler/ViewerPreferences.cc
index ee0977f..60eb31c 100644
--- a/poppler/ViewerPreferences.cc
+++ b/poppler/ViewerPreferences.cc
@@ -101,6 +101,13 @@
if (obj.isBool()) {
pickTrayByPDFSize = obj.getBool();
}
+
+ obj = prefDict->lookup("NumCopies");
+ if (obj.isInt()) {
+ numCopies = obj.getInt();
+ if (numCopies < 2)
+ numCopies = 1;
+ }
}
ViewerPreferences::~ViewerPreferences()
@@ -120,4 +127,5 @@
printScaling = printScalingAppDefault;
duplex = duplexNone;
pickTrayByPDFSize = false;
+ numCopies = 1;
}
diff --git a/poppler/ViewerPreferences.h b/poppler/ViewerPreferences.h
index 346222a..79d63f9 100644
--- a/poppler/ViewerPreferences.h
+++ b/poppler/ViewerPreferences.h
@@ -56,6 +56,7 @@
PrintScaling getPrintScaling() const { return printScaling; }
Duplex getDuplex() const { return duplex; }
bool getPickTrayByPDFSize() const { return pickTrayByPDFSize; }
+ int getNumCopies() const { return numCopies; }
private:
@@ -72,6 +73,7 @@
PrintScaling printScaling;
Duplex duplex;
bool pickTrayByPDFSize;
+ int numCopies;
};
#endif