2011-09-13 19 views
1

pdfのGOTORリンクを使用して外部ファイルのアドレスを取得する際に問題があります。石英を使用。 は、私はリンゴの開発者エリアからいくつかの例を得て、実際にデータ・ディクショナリにGOTOR入り口刚性取得することができた。ここで私が使用したコードは次のとおりです。PDFとGOTORリンクを解析するIOSの問題

リンクをクリック
if (strcmp(actionType, "GoToR") == 0) // GoTo action type 
      { 
       NSLog(@"Annotation is of type GotoR"); 
       if (CGPDFDictionaryGetArray(actionDictionary, "D", &destArray) == false) 
       { 

        const char *actionFile = NULL; // Annotation action type string 
        CGPDFDictionaryGetName(actionDictionary, "F", &actionFile); 
        CGPDFDictionaryGetString(actionDictionary, "D", &destName); 


        NSLog(@"link is %@ filename is:%s",CGPDFStringCopyTextString(destName),actionFile); 

       } 
      } 

、私は次の出力を得ますNSLogから:

リンクは、REF-0000059ファイル名である:(ヌル)

PDF形式の参照がGOTOR注釈は誰もが持っている...先のファイルへのリンクを持つFフィールドを持つべきであると述べて私が間違っていることは何ですか?

よろしくお願いいたします。ソリューションに興味があるかもしれない人には

+0

あなたのPDFファイルへのリンクを置くことができれば、私は見て詳細を教えてください。 – iPDFdev

答えて

0

: それはすべてのケースで動作するようにのためのようGOTOR Fフィールドは、文字列、またはArray両方にすることができ、我々は両方の可能性をチェックする必要があります。

if (strcmp(actionType, "GoToR") == 0) // GoTo action type 
      { 
       NSLog(@"Annotation do tipo GotoR"); 
       if (CGPDFDictionaryGetArray(actionDictionary, "D", &destArray) == false) 
       { 
        CGPDFStringRef actionFile = NULL; 


        CGPDFDictionaryRef linkDictionary = NULL; 

        if (CGPDFDictionaryGetDictionary(actionDictionary, "F", &linkDictionary) == true){ 
         CGPDFDictionaryGetString(linkDictionary, "F", &actionFile); 
        } 
        else{ 
         CGPDFDictionaryGetString(actionDictionary, "F", &actionFile); 
        } 
        *actionFile = NULL; // Annotation action type string 

        CGPDFDictionaryGetString(actionDictionary, "D", &destName); 




        NSLog(@"link is %@ filename is:%@",CGPDFStringCopyTextString(destName),CGPDFStringCopyTextString(actionFile)); 

       } 
      }