I have a pdf , where page 1 is having page number as roman 1 i.e. "i"
Now how to get this information. I know using catalogues i can get page label dictionary
CGPDFDictionaryRef catalog = CGPDFDocumentGetCatalog(document);
if (CGPDFDictionaryGetDictionary(catalog, "PageLabels", &PageLabels) == true)
{
}
and by accessing page label dictionary i have to find range of pages and corresponding operators to actually know the label. i.e.: "D" for arabic decimal, "r" for roman...
Is there a way to directly access this label from CGPDFPageRef
The short answer is no, you cannot get that information from a CGPDFPageRef.
First you have to determine the page number (zero based) of your CGPDFPageRef object. Then you search the page labels array and determine in which label your page number fits. Based on the page label properties (numbering style, start page number, etc) you build the visual page number (the page number displayed by Acrobat as a roman numberal).
Update: The /PageLabels entry is a dictionary. Its /Nums entry is an array with the format: number dictionary number dictionary ... number dictionary.
The number is the start page index (zero based) in the document, the dictionary describes the page label. All the pages starting from the page index till the next page index or the document end will use the label defined next to the index. The page label dictionary is described in PDF specification section 12.4. The /S entry in the page label dictionary specifies the numbering type and the values /r or /R specify the roman numbering type.
Since you mention that your document specifies the /D value (decimal numbering) but in Adobe Reader you see roman numerals in the page number box please provide the PDF file for investigation.