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


C# pdf.PRIndirectReference類代碼示例

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


PRIndirectReference類屬於iTextSharp.text.pdf命名空間,在下文中一共展示了PRIndirectReference類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OutlineTravel

 private void OutlineTravel(PRIndirectReference outline) {
     while (outline != null) {
         PdfDictionary outlineR = (PdfDictionary)PdfReader.GetPdfObjectRelease(outline);
         PRIndirectReference first = (PRIndirectReference)outlineR.Get(PdfName.FIRST);
         if (first != null) {
             OutlineTravel(first);
         }
         PdfReader.KillIndirect(outlineR.Get(PdfName.DEST));
         PdfReader.KillIndirect(outlineR.Get(PdfName.A));
         PdfReader.KillIndirect(outline);
         outline = (PRIndirectReference)outlineR.Get(PdfName.NEXT);
     }
 }
開發者ID:yu0410aries,項目名稱:itextsharp,代碼行數:13,代碼來源:PdfStamperImp.cs

示例2: FieldInformation

     internal FieldInformation(String fieldName, PdfDictionary info, PRIndirectReference refi) {
         this.fieldName = fieldName;
 	    this.info = info;
         this.refi = refi;
     }
開發者ID:jagruti23,項目名稱:itextsharp,代碼行數:5,代碼來源:PRAcroForm.cs

示例3: RefKey

 internal RefKey(PRIndirectReference refi)
 {
     num = refi.Number;
     gen = refi.Generation;
 }
開發者ID:boecko,項目名稱:iTextSharp,代碼行數:5,代碼來源:PdfCopy.cs

示例4: IterateFields

 /**
 * After reading, we index all of the fields. Recursive.
 * @param fieldlist An array of fields
 * @param fieldDict the last field dictionary we encountered (recursively)
 * @param parentPath the pathname of the field, up to this point or null
 */
 virtual protected void IterateFields(PdfArray fieldlist, PRIndirectReference fieldDict, String parentPath) {
     foreach (PRIndirectReference refi in fieldlist.ArrayList) {
         PdfDictionary dict = (PdfDictionary) PdfReader.GetPdfObjectRelease(refi);
         
         // if we are not a field dictionary, pass our parent's values
         PRIndirectReference myFieldDict = fieldDict;
         String fullPath = parentPath;
         PdfString tField = (PdfString)dict.Get(PdfName.T);
         bool isFieldDict = tField != null;
         
         if (isFieldDict) {
             myFieldDict = refi;
             if (parentPath == null) {
                 fullPath = tField.ToString();
             } else {
                 fullPath = parentPath + '.' + tField.ToString();
             }
         }
         
         PdfArray kids = (PdfArray)dict.Get(PdfName.KIDS);
         if (kids != null) {
             PushAttrib(dict);
             IterateFields(kids, myFieldDict, fullPath);
             stack.RemoveAt(stack.Count - 1);   // pop
         }
         else {          // leaf node
             if (myFieldDict != null) {
                 PdfDictionary mergedDict = (PdfDictionary)stack[stack.Count - 1];
                 if (isFieldDict)
                     mergedDict = MergeAttrib(mergedDict, dict);
                 
                 mergedDict.Put(PdfName.T, new PdfString(fullPath));
                 FieldInformation fi = new FieldInformation(fullPath, mergedDict, myFieldDict);
                 fields.Add(fi);
                 fieldByName[fullPath] = fi;
             }
         }
     }
 }
開發者ID:jagruti23,項目名稱:itextsharp,代碼行數:45,代碼來源:PRAcroForm.cs

示例5: InsertPage

 internal void InsertPage(int pageNumber, Rectangle mediabox)
 {
     Rectangle media = new Rectangle(mediabox);
     int rotation = media.Rotation % 360;
     PdfDictionary page = new PdfDictionary(PdfName.PAGE);
     PdfDictionary resources = new PdfDictionary();
     PdfArray procset = new PdfArray();
     procset.Add(PdfName.PDF);
     procset.Add(PdfName.TEXT);
     procset.Add(PdfName.IMAGEB);
     procset.Add(PdfName.IMAGEC);
     procset.Add(PdfName.IMAGEI);
     resources.Put(PdfName.PROCSET, procset);
     page.Put(PdfName.RESOURCES, resources);
     page.Put(PdfName.ROTATE, new PdfNumber(rotation));
     page.Put(PdfName.MEDIABOX, new PdfRectangle(media, rotation));
     PRIndirectReference pref = reader.AddPdfObject(page);
     PdfDictionary parent;
     PRIndirectReference parentRef;
     if (pageNumber > reader.NumberOfPages) {
         PdfDictionary lastPage = reader.GetPageNRelease(reader.NumberOfPages);
         parentRef = (PRIndirectReference)lastPage.Get(PdfName.PARENT);
         parentRef = new PRIndirectReference(reader, parentRef.Number);
         parent = (PdfDictionary)PdfReader.GetPdfObject(parentRef);
         PdfArray kids = (PdfArray)PdfReader.GetPdfObject(parent.Get(PdfName.KIDS), parent);
         kids.Add(pref);
         MarkUsed(kids);
         reader.pageRefs.InsertPage(pageNumber, pref);
     }
     else {
         if (pageNumber < 1)
             pageNumber = 1;
         PdfDictionary firstPage = reader.GetPageN(pageNumber);
         PRIndirectReference firstPageRef = reader.GetPageOrigRef(pageNumber);
         reader.ReleasePage(pageNumber);
         parentRef = (PRIndirectReference)firstPage.Get(PdfName.PARENT);
         parentRef = new PRIndirectReference(reader, parentRef.Number);
         parent = (PdfDictionary)PdfReader.GetPdfObject(parentRef);
         PdfArray kids = (PdfArray)PdfReader.GetPdfObject(parent.Get(PdfName.KIDS), parent);
         ArrayList ar = kids.ArrayList;
         int len = ar.Count;
         int num = firstPageRef.Number;
         for (int k = 0; k < len; ++k) {
             PRIndirectReference cur = (PRIndirectReference)ar[k];
             if (num == cur.Number) {
                 ar.Insert(k, pref);
                 break;
             }
         }
         if (len == ar.Count)
             throw new Exception("Internal inconsistence.");
         MarkUsed(kids);
         reader.pageRefs.InsertPage(pageNumber, pref);
         CorrectAcroFieldPages(pageNumber);
     }
     page.Put(PdfName.PARENT, parentRef);
     while (parent != null) {
         MarkUsed(parent);
         PdfNumber count = (PdfNumber)PdfReader.GetPdfObjectRelease(parent.Get(PdfName.COUNT));
         parent.Put(PdfName.COUNT, new PdfNumber(count.IntValue + 1));
         parent = (PdfDictionary)PdfReader.GetPdfObject(parent.Get(PdfName.PARENT));
     }
 }
開發者ID:hjgode,項目名稱:iTextSharpCF,代碼行數:63,代碼來源:PdfStamperImp.cs

示例6: GetInstance

 /**
 * Reuses an existing image.
 * @param ref the reference to the image dictionary
 * @throws BadElementException on error
 * @return the image
 */    
 public static Image GetInstance(PRIndirectReference iref) {
     PdfDictionary dic = (PdfDictionary)PdfReader.GetPdfObjectRelease(iref);
     int width = ((PdfNumber)PdfReader.GetPdfObjectRelease(dic.Get(PdfName.WIDTH))).IntValue;
     int height = ((PdfNumber)PdfReader.GetPdfObjectRelease(dic.Get(PdfName.HEIGHT))).IntValue;
     Image imask = null;
     PdfObject obj = dic.Get(PdfName.SMASK);
     if (obj != null && obj.IsIndirect()) {
         imask = GetInstance((PRIndirectReference)obj);
     }
     else {
         obj = dic.Get(PdfName.MASK);
         if (obj != null && obj.IsIndirect()) {
             PdfObject obj2 = PdfReader.GetPdfObjectRelease(obj);
             if (obj2 is PdfDictionary)
                 imask = GetInstance((PRIndirectReference)obj);
         }
     }
     Image img = new ImgRaw(width, height, 1, 1, null);
     img.imageMask = imask;
     img.directReference = iref;
     return img;
 }
開發者ID:Gianluigi,項目名稱:dssnet,代碼行數:28,代碼來源:Image.cs

示例7: InsertPage

 internal void InsertPage(int pageNumber, Rectangle mediabox) {
     Rectangle media = new Rectangle(mediabox);
     int rotation = media.Rotation % 360;
     PdfDictionary page = new PdfDictionary(PdfName.PAGE);
     page.Put(PdfName.RESOURCES, new PdfDictionary());
     page.Put(PdfName.ROTATE, new PdfNumber(rotation));
     page.Put(PdfName.MEDIABOX, new PdfRectangle(media, rotation));
     PRIndirectReference pref = reader.AddPdfObject(page);
     PdfDictionary parent;
     PRIndirectReference parentRef;
     if (pageNumber > reader.NumberOfPages) {
         PdfDictionary lastPage = reader.GetPageNRelease(reader.NumberOfPages);
         parentRef = (PRIndirectReference)lastPage.Get(PdfName.PARENT);
         parentRef = new PRIndirectReference(reader, parentRef.Number);
         parent = (PdfDictionary)PdfReader.GetPdfObject(parentRef);
         PdfArray kids = (PdfArray)PdfReader.GetPdfObject(parent.Get(PdfName.KIDS), parent);
         kids.Add(pref);
         MarkUsed(kids);
         reader.pageRefs.InsertPage(pageNumber, pref);
     }
     else {
         if (pageNumber < 1)
             pageNumber = 1;
         PdfDictionary firstPage = reader.GetPageN(pageNumber);
         PRIndirectReference firstPageRef = reader.GetPageOrigRef(pageNumber);
         reader.ReleasePage(pageNumber);
         parentRef = (PRIndirectReference)firstPage.Get(PdfName.PARENT);
         parentRef = new PRIndirectReference(reader, parentRef.Number);
         parent = (PdfDictionary)PdfReader.GetPdfObject(parentRef);
         PdfArray kids = (PdfArray)PdfReader.GetPdfObject(parent.Get(PdfName.KIDS), parent);
         int len = kids.Size;
         int num = firstPageRef.Number;
         for (int k = 0; k < len; ++k) {
             PRIndirectReference cur = (PRIndirectReference)kids[k];
             if (num == cur.Number) {
                 kids.Add(k, pref);
                 break;
             }
         }
         if (len == kids.Size)
             throw new Exception(MessageLocalization.GetComposedMessage("internal.inconsistence"));
         MarkUsed(kids);
         reader.pageRefs.InsertPage(pageNumber, pref);
         CorrectAcroFieldPages(pageNumber);
     }
     page.Put(PdfName.PARENT, parentRef);
     while (parent != null) {
         MarkUsed(parent);
         PdfNumber count = (PdfNumber)PdfReader.GetPdfObjectRelease(parent.Get(PdfName.COUNT));
         parent.Put(PdfName.COUNT, new PdfNumber(count.IntValue + 1));
         parent = parent.GetAsDict(PdfName.PARENT);
     }
 }
開發者ID:yu0410aries,項目名稱:itextsharp,代碼行數:53,代碼來源:PdfStamperImp.cs

示例8: CopyIndirect

 /**
 * Translate a PRIndirectReference to a PdfIndirectReference
 * In addition, translates the object numbers, and copies the
 * referenced object to the output file.
 * NB: PRIndirectReferences (and PRIndirectObjects) really need to know what
 * file they came from, because each file has its own namespace. The translation
 * we do from their namespace to ours is *at best* heuristic, and guaranteed to
 * fail under some circumstances.
 */
 protected virtual PdfIndirectReference CopyIndirect(PRIndirectReference inp)
 {
     PdfIndirectReference theRef;
     RefKey key = new RefKey(inp);
     IndirectReferences iRef;
     indirects.TryGetValue(key, out iRef);
     if (iRef != null) {
         theRef = iRef.Ref;
         if (iRef.Copied) {
             return theRef;
         }
     }
     else {
         theRef = body.PdfIndirectReference;
         iRef = new IndirectReferences(theRef);
         indirects[key] =  iRef;
     }
     PdfObject obj = PdfReader.GetPdfObjectRelease(inp);
     if (obj != null && obj.IsDictionary()) {
         PdfObject type = PdfReader.GetPdfObjectRelease(((PdfDictionary)obj).Get(PdfName.TYPE));
         if (type != null && PdfName.PAGE.Equals(type)) {
             return theRef;
         }
     }
     iRef.SetCopied();
     obj = CopyObject(obj);
     AddToBody(obj, theRef);
     return theRef;
 }
開發者ID:boecko,項目名稱:iTextSharp,代碼行數:38,代碼來源:PdfCopy.cs

示例9: DocumentFont

 /** Creates a new instance of DocumentFont */
 internal DocumentFont(PdfDictionary font) {
     this.refFont = null;
     this.font = font;
     Init();
 }
開發者ID:Gianluigi,項目名稱:dssnet,代碼行數:6,代碼來源:DocumentFont.cs


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