CoreGraphics: How to find out if a PDF file has entries in its catalog?

194 Views Asked by At

I'm trying to find out if a PDF has links/target/outline entries. I use code like this (Monotouch, but should be similar in ObjC):

public bool HasOutlineEntries()
{
    CGPDFDictionary oCatalogDic = oPdfDoc.GetCatalog ();
    CGPDFDictionary oOutlinesDic = null;

    oCatalogDic.GetDictionary ("Outlines", out oOutlinesDic);
    if(oOutlinesDic != null && oOutlinesDic.Count > 0)
    {
        return true;
    }
    return false;
}

Unfortunately this always returns true even if the document does not have any (visible) entries. (oOutlinesDic.Count will be 2). When I get the details of the entries in the dictionary I always find two entries without name and description and an unknown target.

Is there a better way to find what I'm looking for? Or should I always just subtract 2?

0

There are 0 best solutions below