diff options
Diffstat (limited to 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/parser/cpdf_document.cpp | 23 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_document.h | 4 |
2 files changed, 13 insertions, 14 deletions
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp index b163cafbbb..393a6f6785 100644 --- a/core/fpdfapi/parser/cpdf_document.cpp +++ b/core/fpdfapi/parser/cpdf_document.cpp @@ -219,17 +219,6 @@ void CPDF_Document::LoadDocInternal() { m_pRootDict = pRootObj->GetDict(); if (!m_pRootDict) return; - - LoadDocumentInfo(); -} - -void CPDF_Document::LoadDocumentInfo() { - if (!m_pParser) - return; - - CPDF_Object* pInfoObj = GetOrParseIndirectObject(m_pParser->GetInfoObjNum()); - if (pInfoObj) - m_pInfoDict = pInfoObj->GetDict(); } void CPDF_Document::LoadDoc() { @@ -601,6 +590,18 @@ bool CPDF_Document::InsertNewPage(int iPage, CPDF_Dictionary* pPageDict) { return true; } +CPDF_Dictionary* CPDF_Document::GetInfo() { + if (m_pInfoDict) + return m_pInfoDict.Get(); + + if (!m_pParser || !m_pParser->GetInfoObjNum()) + return nullptr; + + CPDF_Reference ref(this, m_pParser->GetInfoObjNum()); + m_pInfoDict = ToDictionary(ref.GetDirect()); + return m_pInfoDict.Get(); +} + void CPDF_Document::DeletePage(int iPage) { CPDF_Dictionary* pPages = GetPagesDict(); if (!pPages) diff --git a/core/fpdfapi/parser/cpdf_document.h b/core/fpdfapi/parser/cpdf_document.h index d196438e80..94d20504c5 100644 --- a/core/fpdfapi/parser/cpdf_document.h +++ b/core/fpdfapi/parser/cpdf_document.h @@ -63,8 +63,7 @@ class CPDF_Document : public CPDF_IndirectObjectHolder { CPDF_Parser* GetParser() const { return m_pParser.get(); } const CPDF_Dictionary* GetRoot() const { return m_pRootDict; } CPDF_Dictionary* GetRoot() { return m_pRootDict; } - const CPDF_Dictionary* GetInfo() const { return m_pInfoDict.Get(); } - CPDF_Dictionary* GetInfo() { return m_pInfoDict.Get(); } + CPDF_Dictionary* GetInfo(); void DeletePage(int iPage); int GetPageCount() const; @@ -101,7 +100,6 @@ class CPDF_Document : public CPDF_IndirectObjectHolder { void LoadDoc(); void LoadLinearizedDoc(const CPDF_LinearizedHeader* pLinearizationParams); void LoadPages(); - void LoadDocumentInfo(); void CreateNewDoc(); CPDF_Dictionary* CreateNewPage(int iPage); |