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

GetGlobal() public method

public GetGlobal ( bool for_embedding ) : byte[]
for_embedding bool
return byte[]
        public byte[] GetGlobal(bool for_embedding) {
            MemoryStream os = new MemoryStream();
            try {
                foreach (JBIG2Segment s in globals.Keys) {
                    if ( for_embedding && 
                            ( s.type == END_OF_FILE || s.type == END_OF_PAGE ) ) {
                        continue;
                    }
                    os.Write(s.headerData, 0, s.headerData.Length);
                    os.Write(s.data, 0, s.data.Length);
                }
                os.Close();
            } catch {
            }
            if ( os.Length <= 0 ) {
                return null;
            }
            return os.ToArray();
        }
        

Usage Example

Beispiel #1
0
 /**
 * Gets a byte array that can be used as a /JBIG2Globals,
 * or null if not applicable to the given jbig2.
 * @param   ra  an random access file or array
 * @return  a byte array
 */
 public static byte[] GetGlobalSegment(RandomAccessFileOrArray ra ) {
     try {
         JBIG2SegmentReader sr = new JBIG2SegmentReader(ra);
         sr.Read();
         return sr.GetGlobal(true);
     } catch {
         return null;
     }
 }
All Usage Examples Of iTextSharp.text.pdf.codec.JBIG2SegmentReader::GetGlobal