Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 public PdfArray(PdfObject parent, ParseArray array)
     : base(parent, array)
 {
 }