summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_document.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/parser/cpdf_document.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_document.cpp23
1 files changed, 12 insertions, 11 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)