public char CheckPdfHeader() { file.StartOffset = 0; String str = ReadString(1024); int idx = str.IndexOf("%PDF-"); if (idx < 0) throw new IOException("PDF header signature not found."); file.StartOffset = idx; return str[idx + 7]; }