开发者

CGPDFArray popped but zero count

I'm running the following:

if (CGPDFDictionaryGetObject(dict, "DescendantFonts", &object))
  {
    CGPDFObjectType objectType = CGPDFObjectGetType(object);
    switch (objectType)
    {
      case kCGPDFObjectTypeArray:
      {
        CGPDFArrayRef anArray = NULL;
        CGPDFObjectGetValue(object, kCGPDFObjectTypeArray, NULL);
        NSLog(@"%i", CGPDFArrayGetCount(anArray));
      }
        break;
      default:
        break;
    }
  }

to extract information from a PDF page font dictionary and it finds something when I have a truetype font.

An example from the PDF guide is:

14 0 obj 
<<
/Type /Font
/Subtype /Type0
/BaseFont /HeiseiMin−W5−90ms−RKSJ−H
/Encoding /90ms−RKSJ−H
/DescendantFonts [15 0 R]
>>
endobj开发者_运维知识库

However, the array always has count zero! [It's supposed to be "a one-element array."] How can this be? - the PDF guidelines also stipulate that this array is required and "specif(ies) the CIDFont dictionary that is the descendant of this Type 0 font." How can it have count zero and satisfy the requirement that it contain this dictionary?


Look at anArray in this part of your code:

CGPDFArrayRef anArray = NULL;
CGPDFObjectGetValue(object, kCGPDFObjectTypeArray, NULL);
NSLog(@"%i", CGPDFArrayGetCount(anArray));

It's never set to anything other than NULL. You probably intended it to be:

CGPDFObjectGetValue(object, kCGPDFObjectTypeArray, &anArray);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜