コード例 #1
0
ファイル: PdfRectangle.cs プロジェクト: xinqinglhj/PdfReader
        public PdfRectangle(PdfObject parent, ParseArray array)
            : base(parent, array)
        {
            // Extract raw values
            float lx = ObjectToFloat(array.Objects[0]);
            float ly = ObjectToFloat(array.Objects[1]);
            float ux = ObjectToFloat(array.Objects[2]);
            float uy = ObjectToFloat(array.Objects[3]);

            // Normalize so the lower-left and upper-right are actually those values
            LowerLeftX  = Math.Min(lx, ux);
            LowerLeftY  = Math.Min(ly, uy);
            UpperRightX = Math.Max(lx, ux);
            UpperRightY = Math.Max(ly, uy);
        }
コード例 #2
0
        public byte[] DecodeBytes(byte[] bytes)
        {
            if (HasFilter)
            {
                // Get the filtering as an array to be applied in order (if a single filter then convert from Name to an Array of one entry)
                ParseObjectBase obj     = Dictionary["Filter"];
                ParseArray      filters = obj as ParseArray;
                if ((filters == null) && (obj is ParseName))
                {
                    filters = new ParseArray(new List <ParseObjectBase>()
                    {
                        obj
                    });
                }

                foreach (ParseName filter in filters.Objects)
                {
                    switch (filter.Value)
                    {
                    case "Fl":
                    case "FlateDecode":
                        bytes = FlateDecode(bytes);
                        break;

                    case "DCT":
                    case "DCTDecode":
                        break;

                    default:
                        throw new NotImplementedException($"Cannot process unrecognized stream filter '{filter.Value}'.");
                    }
                }
            }

            return(bytes);
        }
コード例 #3
0
ファイル: PdfArray.cs プロジェクト: xinqinglhj/PdfReader
 public PdfArray(PdfObject parent, ParseArray array)
     : base(parent, array)
 {
 }