Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Unified Diff: core/src/fpdfdoc/doc_viewerPreferences.cpp

Issue 345123002: Add support to extract viewer preference (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Review feedback Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: core/src/fpdfdoc/doc_viewerPreferences.cpp
diff --git a/core/src/fpdfdoc/doc_viewerPreferences.cpp b/core/src/fpdfdoc/doc_viewerPreferences.cpp
index 617485cfc27b6e5b5d55da488991673826e65fbe..b0f512bb6bc7184aab31aa8047d735b52d71e230 100644
--- a/core/src/fpdfdoc/doc_viewerPreferences.cpp
+++ b/core/src/fpdfdoc/doc_viewerPreferences.cpp
@@ -29,3 +29,43 @@ FX_BOOL CPDF_ViewerPreferences::PrintScaling() const
}
return FX_BSTRC("None") != pDict->GetString(FX_BSTRC("PrintScaling"));
}
+FX_INT32 CPDF_ViewerPreferences::NumCopies() const
+{
+ CPDF_Dictionary *pDict = m_pDoc->GetRoot();
+ pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
+ if (!pDict) {
+ return FALSE;
Bo Xu 2014/06/29 20:58:16 The "NumCopies" entry is optional, and the default
Nikhil 2014/07/07 08:54:18 Done.
+ }
+ return pDict->GetInteger(FX_BSTRC("NumCopies"));
+}
+CPDF_Array* CPDF_ViewerPreferences::PrintPageRange() const
+{
+ CPDF_Dictionary *pDict = m_pDoc->GetRoot();
+ CPDF_Array *pRange = NULL;
+ pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
+ if (!pDict) {
+ return pRange;
+ }
+ pRange = pDict->GetArray(FX_BSTRC("PrintPageRange"));
+ return pRange;
+}
+CPDF_ViewerPreferences::DuplexType CPDF_ViewerPreferences::Duplex() const
+{
+ CPDF_Dictionary *pDict = m_pDoc->GetRoot();
+ CFX_ByteString duplex;
+ pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
+ if (!pDict) {
+ return DuplexUndefined;
+ }
+
+ // Extract and map Duplex property.
+ duplex = pDict->GetString(FX_BSTRC("Duplex"));
+ if (FX_BSTRC("None") == duplex)
+ return DuplexUndefined;
+ if (FX_BSTRC("Simplex") == duplex)
+ return DuplexOff;
+ if (FX_BSTRC("DuplexFlipShortEdge") == duplex)
+ return DuplexFlipShortEdge;
+ if (FX_BSTRC("DuplexFlipLongEdge") == duplex)
+ return DuplexFlipLongEdge;
+}

Powered by Google App Engine
This is Rietveld 408576698