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


C# PdfObject.IsIndirect方法代碼示例

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


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

示例1: GetDirectObject

 public static PdfObject GetDirectObject(PdfObject obj) {
     if (obj == null)
         return null;
     while (obj.IsIndirect())
         obj = PdfReader.GetPdfObjectRelease(obj);
     return obj;
 }
開發者ID:,項目名稱:,代碼行數:7,代碼來源:

示例2: SerObject

            private void SerObject(PdfObject obj, int level, ByteBuffer bb, Dictionary<RefKey, int> serialized)
            {
                if (level <= 0)
                    return;
                if (obj == null) {
                    bb.Append("$Lnull");
                    return;
                }

                PdfIndirectReference refe = null;
                ByteBuffer savedBb = null;

                if (obj.IsIndirect()) {
                    refe = (PdfIndirectReference)obj;
                    RefKey key = new RefKey(refe);
                    if (serialized.ContainsKey(key)) {
                        bb.Append(serialized[key]);
                        return;
                    }
                    else {
                        savedBb = bb;
                        bb = new ByteBuffer();
                    }
                }
                obj = PdfReader.GetPdfObject(obj);
                if (obj.IsStream()) {
                    bb.Append("$B");
                    SerDic((PdfDictionary)obj, level - 1, bb, serialized);
                    if (level > 0) {
                        bb.Append(DigestAlgorithms.Digest("MD5", PdfReader.GetStreamBytesRaw((PRStream)obj)));
                    }
                }
                else if (obj.IsDictionary()) {
                    SerDic((PdfDictionary)obj, level - 1, bb,serialized);
                }
                else if (obj.IsArray()) {
                    SerArray((PdfArray)obj, level - 1, bb,serialized);
                }
                else if (obj.IsString()) {
                    bb.Append("$S").Append(obj.ToString());
                }
                else if (obj.IsName()) {
                    bb.Append("$N").Append(obj.ToString());
                }
                else
                    bb.Append("$L").Append(obj.ToString());

                if (savedBb != null) {
                    RefKey key = new RefKey(refe);
                    if (!serialized.ContainsKey(key))
                        serialized[key] = CalculateHash(bb.Buffer);
                    savedBb.Append(bb);
                }
            }
開發者ID:jagruti23,項目名稱:itextsharp,代碼行數:54,代碼來源:PdfSmartCopy.cs

示例3: RemoveRefFromArray

 private int RemoveRefFromArray(PdfArray array, PdfObject refo)
 {
     if (refo == null || !refo.IsIndirect())
         return array.Size;
     PdfIndirectReference refi = (PdfIndirectReference)refo;
     for (int j = 0; j < array.Size; ++j) {
         PdfObject obj = array[j];
         if (!obj.IsIndirect())
             continue;
         if (((PdfIndirectReference)obj).Number == refi.Number)
             array.Remove(j--);
     }
     return array.Size;
 }
開發者ID:JamieMellway,項目名稱:iTextSharpLGPL-Monotouch,代碼行數:14,代碼來源:AcroFields.cs

示例4: AddKid

        private void AddKid(PdfObject obj)
        {
            if (!obj.IsIndirect())
                return;
            PRIndirectReference currRef = (PRIndirectReference)obj;
            RefKey key =  new RefKey(currRef);
            if (!writer.indirects.ContainsKey(key)) {
                writer.CopyIndirect(currRef, true, false);
            }
            PdfIndirectReference newKid = writer.indirects[key].Ref;

            if (writer.updateRootKids) {
                AddKid(structureTreeRoot, newKid);
            }
        }
開發者ID:,項目名稱:,代碼行數:15,代碼來源:

示例5: GetPdfObject

 /**
 * Reads a <CODE>PdfObject</CODE> resolving an indirect reference
 * if needed.
 * @param obj the <CODE>PdfObject</CODE> to read
 * @return the resolved <CODE>PdfObject</CODE>
 */    
 public static PdfObject GetPdfObject(PdfObject obj) {
     if (obj == null)
         return null;
     if (!obj.IsIndirect())
         return obj;
     PRIndirectReference refi = (PRIndirectReference)obj;
     int idx = refi.Number;
     bool appendable = refi.Reader.appendable;
     obj = refi.Reader.GetPdfObject(idx);
     if (obj == null) {
         return null;
     }
     else {
         if (appendable) {
             switch (obj.Type) {
                 case PdfObject.NULL:
                     obj = new PdfNull();
                     break;
                 case PdfObject.BOOLEAN:
                     obj = new PdfBoolean(((PdfBoolean)obj).BooleanValue);
                     break;
                 case PdfObject.NAME:
                     obj = new PdfName(obj.GetBytes());
                     break;
             }
             obj.IndRef = refi;
         }
         return obj;
     }
 }
開發者ID:,項目名稱:,代碼行數:36,代碼來源:

示例6: KillIndirect

 /**
 * Eliminates the reference to the object freeing the memory used by it and clearing
 * the xref entry.
 * @param obj the object. If it's an indirect reference it will be eliminated
 * @return the object or the already erased dereferenced object
 */    
 public static PdfObject KillIndirect(PdfObject obj) {
     if (obj == null || obj.IsNull())
         return null;
     PdfObject ret = GetPdfObjectRelease(obj);
     if (obj.IsIndirect()) {
         PRIndirectReference refi = (PRIndirectReference)obj;
         PdfReader reader = refi.Reader;
         int n = refi.Number;
         reader.xrefObj[n] = null;
         if (reader.partial)
             reader.xref[n * 2] = -1;
     }
     return ret;
 }
開發者ID:,項目名稱:,代碼行數:20,代碼來源:

示例7: KillXref

 virtual protected internal void KillXref(PdfObject obj) {
     if (obj == null)
         return;
     if ((obj is PdfIndirectReference) && !obj.IsIndirect())
         return;
     switch (obj.Type) {
         case PdfObject.INDIRECT: {
             int xr = ((PRIndirectReference)obj).Number;
             obj = xrefObj[xr];
             xrefObj[xr] = null;
             freeXref = xr;
             KillXref(obj);
             break;
         }
         case PdfObject.ARRAY: {
             PdfArray t = (PdfArray)obj;
             for (int i = 0; i < t.Size; ++i)
                 KillXref(t[i]);
             break;
         }
         case PdfObject.STREAM:
         case PdfObject.DICTIONARY: {
             PdfDictionary dic = (PdfDictionary)obj;
             foreach (PdfName key in dic.Keys){
                 KillXref(dic.Get(key));
             }
             break;
         }
     }
 }
開發者ID:,項目名稱:,代碼行數:30,代碼來源:

示例8: ReleaseLastXrefPartial

 /**
 * @param obj
 */
 public static void ReleaseLastXrefPartial(PdfObject obj) {
     if (obj == null)
         return;
     if (!obj.IsIndirect())
         return;
     if (!(obj is PRIndirectReference))
         return;
     PRIndirectReference refi = (PRIndirectReference)obj;
     PdfReader reader = refi.Reader;
     if (reader.partial && reader.lastXrefPartial != -1 && reader.lastXrefPartial == refi.Number) {
         reader.xrefObj[reader.lastXrefPartial] = null;
     }
     reader.lastXrefPartial = -1;
 }
開發者ID:,項目名稱:,代碼行數:17,代碼來源:

示例9: Propagate

 private PdfObject Propagate(PdfObject obj) {
     if (obj == null) {
         return new PdfNull();
     } 
     if (obj.IsArray()) {
         PdfArray a = (PdfArray)obj;
         for (int i = 0; i < a.Size; i++) {
             a[i] = Propagate(a[i]);
         }
         return a;
     } 
     if (obj.IsDictionary() || obj.IsStream()) {
         PdfDictionary d = (PdfDictionary)obj;
         PdfDictionary newD = new PdfDictionary();
         foreach (PdfName key in d.Keys) {
             newD.Put(key, Propagate(d.Get(key)));
         }
         return newD;
     } 
     if (obj.IsIndirect()) {
         obj = PdfReader.GetPdfObject(obj);
         return AddToBody(Propagate(obj)).IndirectReference;
     } 
     return obj;
 }
開發者ID:,項目名稱:,代碼行數:25,代碼來源:

示例10: SerObject

 private void SerObject(PdfObject obj, int level, ByteBuffer bb) {
     if (level <= 0)
         return;
     if (obj == null) {
         bb.Append("$Lnull");
         return;
     }
     if (obj.IsIndirect()) {
         if (serialized.Contains(obj))
             return;
         else
             serialized.Add(obj);
     }
     obj = PdfReader.GetPdfObject(obj);
     if (obj.IsStream()) {
         bb.Append("$B");
         SerDic((PdfDictionary)obj, level - 1, bb);
         if (level > 0) {
             bb.Append(DigestAlgorithms.Digest("MD5", PdfReader.GetStreamBytesRaw((PRStream)obj)));
         }
     }
     else if (obj.IsDictionary()) {
         SerDic((PdfDictionary)obj, level - 1, bb);
     }
     else if (obj.IsArray()) {
         SerArray((PdfArray)obj, level - 1, bb);
     }
     else if (obj.IsString()) {
         bb.Append("$S").Append(obj.ToString());
     }
     else if (obj.IsName()) {
         bb.Append("$N").Append(obj.ToString());
     }
     else
         bb.Append("$L").Append(obj.ToString());
 }
開發者ID:,項目名稱:,代碼行數:36,代碼來源:

示例11: RemoveRefFromArray

 private int RemoveRefFromArray(PdfArray array, PdfObject refo)
 {
     ArrayList ar = array.ArrayList;
     if (refo == null || !refo.IsIndirect())
         return ar.Count;
     PdfIndirectReference refi = (PdfIndirectReference)refo;
     for (int j = 0; j < ar.Count; ++j) {
         PdfObject obj = (PdfObject)ar[j];
         if (!obj.IsIndirect())
             continue;
         if (((PdfIndirectReference)obj).Number == refi.Number)
             ar.RemoveAt(j--);
     }
     return ar.Count;
 }
開發者ID:hjgode,項目名稱:iTextSharpCF,代碼行數:15,代碼來源:AcroFields.cs

示例12: Propagate

 private PdfObject Propagate(PdfObject obj) {
     if (obj == null) {
         return new PdfNull();
     } else if (obj.IsArray()) {
         PdfArray a = (PdfArray)obj;
         for (int i = 0; i < a.Size; i++) {
             a.Set(i, Propagate(a.GetPdfObject(i)));
         }
         return a;
     } else if (obj.IsDictionary() || obj.IsStream()) {
         PdfDictionary d = (PdfDictionary)obj;
         List<PdfName> keys = new List<PdfName>(d.Keys);
         foreach (PdfName key in keys) {
             d.Put(key, Propagate(d.Get(key)));
         }
         return d;
     } else if (obj.IsIndirect()) {
         obj = PdfReader.GetPdfObject(obj);
         return AddToBody(Propagate(obj)).IndirectReference;
     } else
         return obj;
 }
開發者ID:joshaxey,項目名稱:Simple-PDFMerge,代碼行數:22,代碼來源:PdfCopy.cs


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