iTextSharp.text.pdf.codec.JBIG2SegmentReader.Read C# (CSharp) Method

Read() public method

public Read ( ) : void
return void
        public void Read() {
            if ( this.read ) {
                throw new InvalidOperationException("already attempted a Read() on this Jbig2 File");
            }
            this.read = true;
            
            ReadFileHeader();
            // Annex D
            if ( this.sequential ) {
                // D.1
                do {
                    JBIG2Segment tmp = ReadHeader();
                    ReadSegment(tmp);
                    segments[tmp.segmentNumber] = tmp;
                } while ( this.ra.FilePointer < this.ra.Length);
            } else {
                // D.2
                JBIG2Segment tmp;
                do {
                    tmp = ReadHeader();
                    segments[tmp.segmentNumber] = tmp;
                } while ( tmp.type != END_OF_FILE );
                foreach (int ss in segments.Keys) {
                    ReadSegment((JBIG2Segment)segments[ss]);
                }
            }
        }

Usage Example

Example #1
0
        /***
         * Gets the number of pages in a JBIG2 image.
         * @param ra    a random acces file array containing a JBIG2 image
         * @return  the number of pages
         */
        public static int GetNumberOfPages(RandomAccessFileOrArray ra)
        {
            JBIG2SegmentReader sr = new JBIG2SegmentReader(ra);

            sr.Read();
            return(sr.NumberOfPages());
        }
All Usage Examples Of iTextSharp.text.pdf.codec.JBIG2SegmentReader::Read