CPDF_Object* pDictObj = GetDictionaryObject("MyDictionary"); if (pDictObj && pDictObj->GetType() == PDFOBJ_DICTIONARY) { CPDF_Dictionary* pDict = pDictObj->GetDict(); long start_pos = pDict->GetStartPos(); // do something with the start position }
CPDF_Parser parser; parser.StartParse("Sample.pdf", false); for (int i = 0; i < parser.GetPageCount(); i++) { CPDF_Page* pPage = parser.GetPage(i); CPDF_Dictionary* pDict = pPage->m_pFormDict; while (pDict) { long start_pos = pDict->GetStartPos(); // do something with the start position pDict = pDict->GetNext(); } }In this example, we use the CPDF_Parser class to parse a PDF file named "Sample.pdf". Then, we iterate over all pages in the PDF document using the GetPageCount and GetPage methods. For each page, we access the form dictionary using the m_pFormDict member variable of CPDF_Page class. Finally, we iterate over all dictionaries in the form dictionary linked list, and get the start position of each dictionary using the GetStartPos method. The CPDF_Dictionary class and its methods are part of the Foxit PDF SDK, which is a C++ library package for working with PDF files in various platforms and environments.