CPDF_Dictionary dict; CPDF_Array* arr = dict.GetArray("myArray"); if (arr) { // Use arr to manipulate the PDF array } else { // Error handling }
CPDF_Dictionary dict; CPDF_Object* obj = dict.GetObject("myArray"); if (obj && obj->IsArray()) { CPDF_Array* arr = obj->AsArray(); // Use arr to manipulate the PDF array } else { // Error handling }In this example, we use the GetObject function to retrieve an object from the dictionary. We check if the object exists and if it is an array by using the IsArray function. If it is an array, we can use the AsArray function to convert the CPDF_Object pointer to a CPDF_Array pointer, which we can use to manipulate the PDF array. The CPDF_Dictionary and CPDF_Array classes are part of the MuPDF C++ package library.