1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
7 #include "../../include/fpdfdoc/fpdf_doc.h"
8 CPDF_ViewerPreferences::CPDF_ViewerPreferences(CPDF_Document *pDoc): m_pDoc(pDoc)
11 CPDF_ViewerPreferences::~CPDF_ViewerPreferences()
14 FX_BOOL CPDF_ViewerPreferences::IsDirectionR2L() const
16 CPDF_Dictionary *pDict = m_pDoc->GetRoot();
17 pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
21 return FX_BSTRC("R2L") == pDict->GetString(FX_BSTRC("Direction"));
23 FX_BOOL CPDF_ViewerPreferences::PrintScaling() const
25 CPDF_Dictionary *pDict = m_pDoc->GetRoot();
26 pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
30 return FX_BSTRC("None") != pDict->GetString(FX_BSTRC("PrintScaling"));
32 FX_INT32 CPDF_ViewerPreferences::NumCopies() const
34 CPDF_Dictionary *pDict = m_pDoc->GetRoot();
35 pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
39 return pDict->GetInteger(FX_BSTRC("NumCopies"));
41 CPDF_Array* CPDF_ViewerPreferences::PrintPageRange() const
43 CPDF_Dictionary *pDict = m_pDoc->GetRoot();
44 CPDF_Array *pRange = NULL;
45 pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
49 pRange = pDict->GetArray(FX_BSTRC("PrintPageRange"));
52 CFX_ByteString CPDF_ViewerPreferences::Duplex() const
54 CPDF_Dictionary *pDict = m_pDoc->GetRoot();
55 pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
57 return FX_BSTRC("None");
59 return pDict->GetString(FX_BSTRC("Duplex"));