Exemplo n.º 1
0
 public PDFImage(PDFStream stream, PDFDictionary filterParams)
     : base(stream)
 {
     try
     {
         Image = new Bitmap(new MemoryStream(Data));
     }
     catch
     {
     }
 }
Exemplo n.º 2
0
        public PDFStream ApplyFilter(string filter, PDFDictionary filterParams)
        {
            switch (filter)
            {
            case "FlateDecode": return(FlateDecode(filterParams));

            case "DCTDecode": return(new PDFImage(this, filterParams));

            case "CCITTFaxDecode": return(this);

            default: throw new NotImplementedException();
            }
        }
Exemplo n.º 3
0
        public IPDFToken Parse(Stack <IPDFToken> stack)
        {
            switch (TokenType)
            {
            case PDFTokenType.EndDictionary:
                return(PDFDictionary.Parse(stack));

            case PDFTokenType.EndList:
                return(PDFList.Parse(stack));

            case PDFTokenType.EOF:
                return(PDFTrailer.Parse(stack));

            default:
                return(this);
            }
        }
Exemplo n.º 4
0
        public PDFStream FlateDecode(PDFDictionary filterParams)
        {
            using (ZlibStream strm = new ZlibStream(new MemoryStream(Data), CompressionMode.Decompress))
            {
                byte[] outdata = new byte[1048576];
                int    pos     = 0;
                int    len     = 0;

                do
                {
                    Array.Resize(ref outdata, pos + 1048576);
                    len  = strm.Read(outdata, pos, outdata.Length - pos);
                    pos += len;
                }while (len > 0);

                Array.Resize(ref outdata, pos);

                return(new PDFStream {
                    Data = outdata, Options = Options
                });
            }
        }