當前位置: 首頁>>代碼示例>>C#>>正文


C# PdfArray.GetDirectObject方法代碼示例

本文整理匯總了C#中iTextSharp.text.pdf.PdfArray.GetDirectObject方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfArray.GetDirectObject方法的具體用法?C# PdfArray.GetDirectObject怎麽用?C# PdfArray.GetDirectObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在iTextSharp.text.pdf.PdfArray的用法示例。


在下文中一共展示了PdfArray.GetDirectObject方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RemoveOCGsFromArray

 /// <summary>
 /// Searches an array for references to OCGs that need to be removed. </summary>
 /// <param name="array">	the array </param>
 /// <param name="ocgs">	the removal list </param>
 private void RemoveOCGsFromArray(PdfArray array, ICollection<string> ocgs)
 {
     if (array == null)
     {
         return;
     }
     PdfObject o;
     PdfDictionary dict;
     IList<int?> remove = new List<int?>();
     for (int i = array.Size; i > 0; )
     {
         o = array.GetDirectObject(--i);
         if (o.IsDictionary())
         {
             dict = (PdfDictionary)o;
             if (IsToBeRemoved(dict, ocgs))
             {
                 remove.Add(i);
             }
             else
             {
                 RemoveOCGsFromArray(dict, PdfName.OCGS, ocgs);
             }
         }
         if (o.IsArray())
         {
             RemoveOCGsFromArray((PdfArray)o, ocgs);
         }
     }
     foreach (int i in remove)
     {
         array.Remove(i);
     }
 }
開發者ID:,項目名稱:,代碼行數:38,代碼來源:

示例2: InspectChildArray

 /**
  * If the child of a structured element is an array, we need to loop over
  * the elements.
  * 
  * @param k
  *            the child array to inspect
  */
 public void InspectChildArray(PdfArray k) {
     if (k == null)
         return;
     for (int i = 0; i < k.Size; i++) {
         InspectChild(k.GetDirectObject(i));
     }
 }
開發者ID:,項目名稱:,代碼行數:14,代碼來源:

示例3: FindAndCopyMarks

        private ReturnType FindAndCopyMarks(PdfArray pages, int arrayNumber, int newArrayNumber){
            if (pages.GetAsNumber(0).IntValue > arrayNumber)
                return ReturnType.BELOW;
            if (pages.GetAsNumber(pages.Size - 2).IntValue < arrayNumber)
                return ReturnType.ABOVE;
            int cur = pages.Size/4;
            int begin = 0;
            int curNumber;
            while (true) {
                curNumber = pages.GetAsNumber((begin + cur) * 2).IntValue;
                if (curNumber == arrayNumber) {
                    PdfObject obj = pages.GetDirectObject((begin + cur) * 2 + 1);
                    while (obj.IsIndirect())
                        obj = PdfReader.GetPdfObjectRelease(obj);
                    //invalid Nums
                    if (!obj.IsArray())
                        return ReturnType.NOTFOUND;

                    PdfObject firstNotNullKid = null;
                    foreach (PdfObject numObj in (PdfArray)obj){
                        if (numObj.IsNull())
                            continue;
                        PdfObject res = writer.CopyObject(numObj, true, false);
                        if (firstNotNullKid == null)
                            firstNotNullKid = res;
                        structureTreeRoot.SetPageMark(newArrayNumber, (PdfIndirectReference) res);
                    }
                    //Add kid to structureTreeRoot from structTreeRoot
                    PdfObject structKids = structTreeRoot.Get(PdfName.K);
                    if (structKids == null || (!structKids.IsArray() && !structKids.IsIndirect())) {
                        // incorrect syntax of tags
                        AddKid(structureTreeRoot, firstNotNullKid);
                    } else {
                        if (structKids.IsIndirect()) {
                            AddKid(structKids);
                        } else { //structKids.isArray()
                            foreach (PdfObject kid in (PdfArray)structKids)
                                AddKid(kid);
                        }
                    }

                    return ReturnType.FOUND;
                }
                if (curNumber < arrayNumber) {
                    begin += cur;
                    cur /= 2;
                    if (cur == 0)
                        cur = 1;
                    if (cur + begin == pages.Size)
                        return ReturnType.NOTFOUND;
                    continue;
                }
                if (cur + begin == 0)
                    return ReturnType.BELOW;
                if (cur == 0)
                    return ReturnType.NOTFOUND;
                cur /= 2;
            }
        }
開發者ID:,項目名稱:,代碼行數:59,代碼來源:


注:本文中的iTextSharp.text.pdf.PdfArray.GetDirectObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。