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


C# PdfObject类代码示例

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


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

示例1: Decode

        public byte[] Decode(PdfObject decodedObject, byte[] inputData, DecodeParameters decodeParameters)
        {
            FIBITMAP myImage = new FIBITMAP();
            using (MemoryStream stream = new MemoryStream(inputData))
            {
                myImage = FreeImage.LoadFromStream(stream);
            }

            Bitmap bitmap = FreeImage.GetBitmap(myImage);

            decodedObject.ColorSpace = ColorSpace.RGB;

            byte[] result = new byte[decodedObject.Width * decodedObject.Height * 3];

            for (int i = 0; i < decodedObject.Width; i++)
            {
                for (int j = 0; j < decodedObject.Height; j++)
                {
                    Color pixel = bitmap.GetPixel(i, j);

                    int index = j * decodedObject.Width + i;
                    result[index * 3] = pixel.R;
                    result[index * 3 + 1] = pixel.G;
                    result[index * 3 + 2] = pixel.B;
                }
            }

            return result;
        }
开发者ID:Motaz-Al-Zoubi,项目名称:xaml-sdk,代码行数:29,代码来源:JpxDecoder.cs

示例2: PdfReference

    // About PdfReference 
    // 
    // * A PdfReference holds the either ObjectID or the PdfObject or both.
    // 
    // * Each PdfObject has a PdfReference if and only if it is an indirect object. Direct objects have
    //   no PdfReference, because they are embedded in a parent objects.
    //
    // * PdfReference objects are used to reference PdfObject instances. A value in a PDF dictionary
    //   or array that is a PdfReference represents an indirect reference. A value in a PDF dictionary or
    //   or array that is a PdfObject represents a direct (or embeddded) object.
    //
    // * When a PDF file is imported, the PdfXRefTable is filled with PdfReference objects keeping the
    //   ObjectsIDs and file positions (offsets) of all indirect objects.
    //
    // * Indirect objects can easily be renumbered because they do not rely on their ObjectsIDs.
    //
    // * During modification of a document the ObjectID of an indirect object has no meaning,
    //   except that they must be different in pairs.

    /// <summary>
    /// Initializes a new PdfReference instance for the specified indirect object.
    /// </summary>
    public PdfReference(PdfObject pdfObject)
    {
      Debug.Assert(pdfObject.Reference == null, "Must not create iref for an object that already has one.");
      this.value = pdfObject;
#if UNIQUE_IREF && DEBUG
      this.uid = ++PdfReference.counter;
#endif
    }
开发者ID:AnthonyNystrom,项目名称:Pikling,代码行数:30,代码来源:PdfReference.cs

示例3: PdfDictionary

        internal PdfDictionary(
			PdfObject	Parent
			)
        {
            KeyValue = new List<PdfKeyValue>();
            this.Parent = Parent;
            this.Document = Parent.Document;
            return;
        }
开发者ID:UnionMexicanaDelNorte,项目名称:cheques,代码行数:9,代码来源:PdfDictionary.cs

示例4: CacheObject

 virtual public void CacheObject(PdfIndirectReference iref, PdfObject obj) {
     if (obj.Type == 0) {
         cachedObjects[new RefKey(iref)] = obj;
     }
     else if (obj is PdfDictionary) {
         cachedObjects[new RefKey(iref)] = CleverPdfDictionaryClone((PdfDictionary) obj);
     }
     else if (obj.IsArray()) {
         cachedObjects[new RefKey(iref)] = CleverPdfArrayClone((PdfArray) obj);
     }
 }
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:11,代码来源:PdfAChecker.cs

示例5: Process

 /**
  * Processes an object. If the object is indirect, it is added to the
  * list of resources. If not, it is just processed.
  * @param object    the object to process
  */
 protected void Process(PdfObject @object) {
     PRIndirectReference @ref = @object.IndRef;
     if (@ref == null) {
         LoopOver(@object);
     } else {
         bool containsKey = resources.ContainsKey(@ref.Number);
         resources[@ref.Number] = @object;
         if (!containsKey)
             LoopOver(@object);
     }
 }
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:16,代码来源:PdfResourceCounter.cs

示例6: Add

        /// <summary>
        /// Adds a PdfObject to the table.
        /// </summary>
        public void Add(PdfObject value)
        {
            if (value.Owner == null)
                value.Document = _document;
            else
                Debug.Assert(value.Owner == _document);

            if (value.ObjectID.IsEmpty)
                value.SetObjectID(GetNewObjectNumber(), 0);

            if (ObjectTable.ContainsKey(value.ObjectID))
                throw new InvalidOperationException("Object already in table.");

            ObjectTable.Add(value.ObjectID, value.Reference);
        }
开发者ID:Sl0vi,项目名称:PDFsharp,代码行数:18,代码来源:PdfCrossReferenceTable.cs

示例7: Add

 internal 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);
         PdfCrossReference pxref = new PdfCrossReference(refNumber, position);
         xrefs.Remove(pxref);
         xrefs[pxref] = null;
         indirect.WriteTo(writer.Os);
         position = writer.Os.Counter;
         return indirect;
     }
 }
开发者ID:pixelia-es,项目名称:RazorPDF2,代码行数:19,代码来源:PdfWriter.cs

示例8: TextToPdfString

        ////////////////////////////////////////////////////////////////////
        // C# string text to PDF strings only
        ////////////////////////////////////////////////////////////////////
        internal String TextToPdfString(
			String		Text,
			PdfObject	Parent
			)
        {
            // convert C# string to byte array
            Byte[] ByteArray = TextToByteArray(Text);

            // encryption is active. PDF string must be encrypted except for encryption dictionary
            if(Encryption != null && Encryption != Parent) ByteArray = Encryption.EncryptByteArray(Parent.ObjectNumber, ByteArray);

            // convert byte array to PDF string format
            return(ByteArrayToPdfString(ByteArray));
        }
开发者ID:UnionMexicanaDelNorte,项目名称:cheques,代码行数:17,代码来源:PdfDocument.cs

示例9: GetDirectStream

 virtual protected PdfStream GetDirectStream(PdfObject obj) {
     obj = GetDirectObject(obj);
     if (obj != null && obj.IsStream())
         return (PdfStream) obj;
     return null;
 }
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:6,代码来源:PdfAChecker.cs

示例10: GetDirectArray

 virtual protected PdfArray GetDirectArray(PdfObject obj) {
     obj = GetDirectObject(obj);
     if (obj != null && obj.IsArray())
         return (PdfArray) obj;
     return null;
 }
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:6,代码来源:PdfAChecker.cs

示例11: GetDirectDictionary

 virtual protected PdfDictionary GetDirectDictionary(PdfObject obj) {
     obj = GetDirectObject(obj);
     if (obj != null && obj is PdfDictionary)
         return (PdfDictionary) obj;
     return null;
 }
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:6,代码来源:PdfAChecker.cs

示例12: FindColorspace

 /**
  * Sets state of this object according to the color space 
  * @param colorspace the colorspace to use
  * @param allowIndexed whether indexed color spaces will be resolved (used for recursive call)
  * @throws IOException if there is a problem with reading from the underlying stream  
  */
 private void FindColorspace(PdfObject colorspace, bool allowIndexed) {
     if (colorspace == null && bpc == 1){ // handle imagemasks
         stride = (width*bpc + 7) / 8;
         pngColorType = 0;
     }
     else if (PdfName.DEVICEGRAY.Equals(colorspace)) {
         stride = (width * bpc + 7) / 8;
         pngColorType = 0;
     }
     else if (PdfName.DEVICERGB.Equals(colorspace)) {
         if (bpc == 8 || bpc == 16) {
             stride = (width * bpc * 3 + 7) / 8;
             pngColorType = 2;
         }
     }
     else if (colorspace is PdfArray) {
         PdfArray ca = (PdfArray)colorspace;
         PdfObject tyca = ca.GetDirectObject(0);
         if (PdfName.CALGRAY.Equals(tyca)) {
             stride = (width * bpc + 7) / 8;
             pngColorType = 0;
         }
         else if (PdfName.CALRGB.Equals(tyca)) {
             if (bpc == 8 || bpc == 16) {
                 stride = (width * bpc * 3 + 7) / 8;
                 pngColorType = 2;
             }
         }
         else if (PdfName.ICCBASED.Equals(tyca)) {
             PRStream pr = (PRStream)ca.GetDirectObject(1);
             int n = pr.GetAsNumber(PdfName.N).IntValue;
             if (n == 1) {
                 stride = (width * bpc + 7) / 8;
                 pngColorType = 0;
                 icc = PdfReader.GetStreamBytes(pr);
             }
             else if (n == 3) {
                 stride = (width * bpc * 3 + 7) / 8;
                 pngColorType = 2;
                 icc = PdfReader.GetStreamBytes(pr);
             }
         }
         else if (allowIndexed && PdfName.INDEXED.Equals(tyca)) {
             FindColorspace(ca.GetDirectObject(1), false);
             if (pngColorType == 2) {
                 PdfObject id2 = ca.GetDirectObject(3);
                 if (id2 is PdfString) {
                     palette = ((PdfString)id2).GetBytes();
                 }
                 else if (id2 is PRStream) {
                     palette = PdfReader.GetStreamBytes(((PRStream)id2));
                 }
                 stride = (width * bpc + 7) / 8;
                 pngColorType = 3;
             }
         }
     }
 }
开发者ID:yu0410aries,项目名称:itextsharp,代码行数:64,代码来源:PdfImageObject.cs

示例13: SetObject

 /// <summary>
 /// Hack for dead objects.
 /// </summary>
 internal void SetObject(PdfObject value)
 {
   this.value = value;
 }
开发者ID:AnthonyNystrom,项目名称:Pikling,代码行数:7,代码来源:PdfReference.cs

示例14: MarkUsed

 private void MarkUsed(PdfObject obj)
 {
     if (!append)
         return;
     ((PdfStamperImp)writer).MarkUsed(obj);
 }
开发者ID:pixelia-es,项目名称:RazorPDF2,代码行数:6,代码来源:AcroFields.cs

示例15: AddToObjStm

 private 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:pixelia-es,项目名称:RazorPDF2,代码行数:20,代码来源:PdfWriter.cs


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