コード例 #1
0
        private void                                _readContent(PdfObjectReader obj)
        {
            byte[] buf = new byte[4096];

            using (Stream Source = obj.GetUncompressStream()) {
                int rsize;

                while ((rsize = Source.Read(buf, 0, buf.Length)) > 0)
                {
                    _dataStream.Write(buf, 0, rsize);
                }
            }
        }
コード例 #2
0
        private PdfValue                    _readObj(PdfStreamReader reader, bool compressed)
        {
            var value = reader.ReadValue();
            var token = (!compressed && reader.Position < reader.Stream.Length) ? reader.ReadToken() : null;

            if (token != null && value is PdfDictionary && token.Type == PdfValueType.StreamBegin)
            {
                var streamBegin  = reader.Position;
                var streamLength = ((PdfDictionary)value).ValueByName <PdfInteger>("Length").Value;
                reader.Skip(streamLength);
                reader.ReadToken(PdfValueType.StreamEnd);
                value = new PdfObjectReader((PdfDictionary)value, new PdfDataStreamReader(_stream, streamBegin, streamLength));
                token = (!compressed && reader.Position < reader.Stream.Length) ? reader.ReadToken() : null;
            }

            if (token != null && token.Type != PdfValueType.ObjectEnd)
            {
                throw new PdfExceptionReader("Missing endobj");
            }

            return(value);
        }
コード例 #3
0
 private PdfContent(PdfContent parent, PdfObjectReader obj)
 {
     _parent = parent;
     _init();
     _readContent(obj);
 }