当前位置: 首页>>代码示例>>C#>>正文


C# pdf.PdfObject类代码示例

本文整理汇总了C#中iTextSharp.text.pdf.PdfObject的典型用法代码示例。如果您正苦于以下问题:C# PdfObject类的具体用法?C# PdfObject怎么用?C# PdfObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PdfObject类属于iTextSharp.text.pdf命名空间,在下文中一共展示了PdfObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetField

 internal bool SetField(String field, PdfObject value) {
     Hashtable map = fields;
     StringTokenizer tk = new StringTokenizer(field, ".");
     if (!tk.HasMoreTokens())
         return false;
     while (true) {
         String s = tk.NextToken();
         Object obj = map[s];
         if (tk.HasMoreTokens()) {
             if (obj == null) {
                 obj = new Hashtable();
                 map[s] = obj;
                 map = (Hashtable)obj;
                 continue;
             }
             else if (obj is Hashtable)
                 map = (Hashtable)obj;
             else
                 return false;
         }
         else {
             if (!(obj is Hashtable)) {
                 map[s] = value;
                 return true;
             }
             else
                 return false;
         }
     }
 }
开发者ID:nicecai,项目名称:iTextSharp-4.1.6,代码行数:30,代码来源:FdfWriter.cs

示例2: GetDirectObject

 public static PdfObject GetDirectObject(PdfObject obj) {
     if (obj == null)
         return null;
     while (obj.IsIndirect())
         obj = PdfReader.GetPdfObjectRelease(obj);
     return obj;
 }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例3: SetField

 internal bool SetField(String field, PdfObject value) {
     Dictionary<String, Object> map = fields;
     StringTokenizer tk = new StringTokenizer(field, ".");
     if (!tk.HasMoreTokens())
         return false;
     while (true) {
         String s = tk.NextToken();
         Object obj;
         map.TryGetValue(s, out obj);
         if (tk.HasMoreTokens()) {
             if (obj == null) {
                 obj = new Dictionary<String, Object>();
                 map[s] = obj;
                 map = (Dictionary<string,object>)obj;
                 continue;
             }
             else if (obj is Dictionary<String, Object>)
                 map = (Dictionary<String, Object>)obj;
             else
                 return false;
         }
         else {
             if (!(obj is Dictionary<String, Object>)) {
                 map[s] = value;
                 return true;
             }
             else
                 return false;
         }
     }
 }
开发者ID:,项目名称:,代码行数:31,代码来源:

示例4: GetContentBytesFromContentObject

 /**
  * Gets the content bytes from a content object, which may be a reference
  * a stream or an array.
  * @param contentObject the object to read bytes from
  * @return the content bytes
  * @throws IOException
  */
 public static byte[] GetContentBytesFromContentObject(PdfObject contentObject) {
     byte[] result;
     switch (contentObject.Type)
     {
         case PdfObject.INDIRECT:
             PRIndirectReference refi = (PRIndirectReference) contentObject;
             PdfObject directObject = PdfReader.GetPdfObjectRelease(refi);
             result = GetContentBytesFromContentObject(directObject);
             break;
         case PdfObject.STREAM:
             PRStream stream = (PRStream) PdfReader.GetPdfObjectRelease(contentObject);
             result = PdfReader.GetStreamBytes(stream);
             break;
         case PdfObject.ARRAY:
             // Stitch together all content before calling ProcessContent(), because
             // ProcessContent() resets state.
             MemoryStream allBytes = new MemoryStream();
             PdfArray contentArray = (PdfArray) contentObject;
             ListIterator<PdfObject> iter = contentArray.GetListIterator();
             while (iter.HasNext()) {
                 PdfObject element = iter.Next();
                 byte[] b;
                 allBytes.Write(b = GetContentBytesFromContentObject(element), 0, b.Length);
                 allBytes.WriteByte((byte)' ');
             }
             result = allBytes.ToArray();
             break;
         default:
             String msg = "Unable to handle Content of type " + contentObject.GetType();
         throw new InvalidOperationException(msg);
     }
     return result;
 }
开发者ID:yu0410aries,项目名称:itextsharp,代码行数:40,代码来源:ContentByteUtils.cs

示例5: AddRange

 internal void AddRange(PdfString from, PdfString to, PdfObject code) {
     byte[] a1 = DecodeStringToByte(from);
     byte[] a2 = DecodeStringToByte(to);
     if (a1.Length != a2.Length || a1.Length == 0)
         throw new ArgumentException("Invalid map.");
     byte[] sout = null;
     if (code is PdfString)
         sout = DecodeStringToByte((PdfString)code);
     int start = a1[a1.Length - 1] & 0xff;
     int end = a2[a2.Length - 1] & 0xff;
     for (int k = start; k <= end; ++k) {
         a1[a1.Length - 1] = (byte)k;
         PdfString s = new PdfString(a1);
         s.SetHexWriting(true);
         if (code is PdfArray) {
             AddChar(s, ((PdfArray)code)[k - start]);
         }
         else if (code is PdfNumber) {
             int nn = ((PdfNumber)code).IntValue + k - start;
             AddChar(s, new PdfNumber(nn));
         }
         else if (code is PdfString) {
             PdfString s1 = new PdfString(sout);
             s1.SetHexWriting(true);
             ++sout[sout.Length - 1];
             AddChar(s, s1);
         }
     }
 }
开发者ID:jagruti23,项目名称:itextsharp,代码行数:29,代码来源:AbstractCMap.cs

示例6: AddChar

 internal override void AddChar(PdfString mark, PdfObject code) {
     if (!(code is PdfNumber))
         return;
     int codepoint;
     String s = DecodeStringToUnicode(mark);
     if (Utilities.IsSurrogatePair(s, 0))
         codepoint = Utilities.ConvertToUtf32(s, 0);
     else
         codepoint = (int)s[0];
     map[((PdfNumber)code).IntValue] = codepoint;
 }
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:11,代码来源:CMapCidUni.cs

示例7: AddToBody

 /**
 * Adds an object to the PDF body.
 * @param object
 * @param refNumber
 * @param inObjStm
 * @return a PdfIndirectObject
 * @throws IOException
 */
 public PdfIndirectObject AddToBody(PdfObject objecta, int refNumber, bool inObjStm) {
     PdfIndirectObject iobj = body.Add(objecta, refNumber, inObjStm);
     return iobj;
 }
开发者ID:,项目名称:,代码行数:12,代码来源:

示例8: PdfTrailer

 // constructors
 
 /**
 * Constructs a PDF-Trailer.
 *
 * @param        size        the number of entries in the <CODE>PdfCrossReferenceTable</CODE>
 * @param        offset      offset of the <CODE>PdfCrossReferenceTable</CODE>
 * @param        root        an indirect reference to the root of the PDF document
 * @param        info        an indirect reference to the info object of the PDF document
 * @param encryption
 * @param fileID
 * @param prevxref
 */
 
 public PdfTrailer(int size, long offset, PdfIndirectReference root, PdfIndirectReference info, PdfIndirectReference encryption, PdfObject fileID, long prevxref) {
     this.offset = offset;
     Put(PdfName.SIZE, new PdfNumber(size));
     Put(PdfName.ROOT, root);
     if (info != null) {
         Put(PdfName.INFO, info);
     }
     if (encryption != null)
         Put(PdfName.ENCRYPT, encryption);
     if (fileID != null)
         Put(PdfName.ID, fileID);
     if (prevxref > 0)
         Put(PdfName.PREV, new PdfNumber(prevxref));
 }
开发者ID:,项目名称:,代码行数:28,代码来源:

示例9: Add

 virtual internal protected PdfIndirectObject Add(PdfObject objecta, int refNumber, bool inObjStm) {
     if (inObjStm && objecta.CanBeInObjStm() && writer.FullCompression) {
         PdfCrossReference pxref = AddToObjStm(objecta, refNumber);
         PdfIndirectObject indirect = new PdfIndirectObject(refNumber, objecta, writer);
         xrefs.Remove(pxref);
         xrefs[pxref] = null;
         return indirect;
     }
     else {
         PdfIndirectObject indirect = new PdfIndirectObject(refNumber, objecta, writer);
         Write(indirect, refNumber);
         return indirect;
     }
 }
开发者ID:,项目名称:,代码行数:14,代码来源:

示例10: SweepKids

 internal void SweepKids(PdfObject obj) {
     PdfObject oo = PdfReader.KillIndirect(obj);
     if (oo == null || !oo.IsDictionary())
         return;
     PdfDictionary dic = (PdfDictionary)oo;
     PdfArray kids = (PdfArray)PdfReader.KillIndirect(dic.Get(PdfName.KIDS));
     if (kids == null)
         return;
     for (int k = 0; k < kids.Size; ++k) {
         SweepKids(kids.GetPdfObject(k));
     }
 }
开发者ID:yu0410aries,项目名称:itextsharp,代码行数:12,代码来源:PdfStamperImp.cs

示例11: AddViewerPreference

 /**
 * @see com.lowagie.text.pdf.interfaces.PdfViewerPreferences#addViewerPreference(com.lowagie.text.pdf.PdfName, com.lowagie.text.pdf.PdfObject)
 */
 public void AddViewerPreference(PdfName key, PdfObject value) {
     fc.AddViewerPreference(key, value); 
 }
开发者ID:nicecai,项目名称:iTextSharp-4.1.6,代码行数:6,代码来源:PdfCopyForms.cs

示例12: AddViewerPreference

 /** @see com.lowagie.text.pdf.interfaces.PdfViewerPreferences#addViewerPreference(com.lowagie.text.pdf.PdfName, com.lowagie.text.pdf.PdfObject) */
 internal void AddViewerPreference(PdfName key, PdfObject value) {
     this.viewerPreferences.AddViewerPreference(key, value);
 }
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:4,代码来源:PdfDocument.cs

示例13: AddToObjStm

 protected PdfWriter.PdfBody.PdfCrossReference AddToObjStm(PdfObject obj, int nObj) {
     if (numObj >= OBJSINSTREAM)
         FlushObjStm();
     if (index == null) {
         index = new ByteBuffer();
         streamObjects = new ByteBuffer();
         currentObjNum = IndirectReferenceNumber;
         numObj = 0;
     }
     int p = streamObjects.Size;
     int idx = numObj++;
     PdfEncryption enc = writer.crypto;
     writer.crypto = null;
     obj.ToPdf(writer, streamObjects);
     writer.crypto = enc;
     streamObjects.Append(' ');
     index.Append(nObj).Append(' ').Append(p).Append(' ');
     return new PdfWriter.PdfBody.PdfCrossReference(2, nObj, currentObjNum, idx);
 }
开发者ID:,项目名称:,代码行数:19,代码来源:

示例14: SetDefaultColorspace

 /**
 * Sets the default colorspace that will be applied to all the document.
 * The colorspace is only applied if another colorspace with the same name
 * is not present in the content.
 * <p>
 * The colorspace is applied immediately when creating templates and at the page
 * end for the main document content.
 * @param key the name of the colorspace. It can be <CODE>PdfName.DEFAULTGRAY</CODE>, <CODE>PdfName.DEFAULTRGB</CODE>
 * or <CODE>PdfName.DEFAULTCMYK</CODE>
 * @param cs the colorspace. A <CODE>null</CODE> or <CODE>PdfNull</CODE> removes any colorspace with the same name
 */    
 public void SetDefaultColorspace(PdfName key, PdfObject cs) {
     if (cs == null || cs.IsNull())
         defaultColorspace.Remove(key);
     defaultColorspace.Put(key, cs);
 }
开发者ID:,项目名称:,代码行数:16,代码来源:

示例15: AddViewerPreference

 /** Adds a viewer preference
 * @param preferences the viewer preferences
 * @see PdfViewerPreferences#addViewerPreference
 */
 public override void AddViewerPreference(PdfName key, PdfObject value) {
     useVp = true;
     this.viewerPreferences.AddViewerPreference(key, value);
 }
开发者ID:yu0410aries,项目名称:itextsharp,代码行数:8,代码来源:PdfStamperImp.cs


注:本文中的iTextSharp.text.pdf.PdfObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。