CPDF_Object* pObject = pDictionary->GetElement("Key"); if (pObject && pObject->GetType() == PDFOBJ_NUMBER) { CPDF_Number* pNumber = pObject->AsNumber(); int value = pNumber->GetInteger(); // do something with the value }
CPDF_Dictionary* pPageDict = pPDFDoc->GetPage(0); CPDF_Dictionary* pParentDict = pPageDict->GetElement("Parent")->AsDictionary(); while (pParentDict) { CPDF_Object* pTypeObj = pParentDict->GetElement("Type"); if (pTypeObj->GetString() == "Pages") break; pParentDict = pParentDict->GetElement("Parent")->AsDictionary(); }This code retrieves the parent dictionary of a CPDF_Dictionary object representing a PDF page, and then iteratively retrieves the parent dictionaries until a dictionary with a "Type" key equal to "Pages" is found. This demonstrates how GetElement can be used to access nested dictionaries within a PDF file. The library package used for this example is likely the Adobe PDF Library SDK or a similar PDF processing library for C++.