Chromium Code Reviews| 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; |
| +} |