JBIG2: Как получить информацию о JBIG2-документе?
В этом разделе
Вот C#/VB.NET код, который демонстрирует, как получить информацию о JBIG2-документе:
public void GetInfoAboutJbig(System.IO.Stream stream)
{
// open JBIG2 file
using (Vintasoft.Imaging.Codecs.ImageFiles.Jbig2.Jbig2File jbig2File =
new Vintasoft.Imaging.Codecs.ImageFiles.Jbig2.Jbig2File(stream))
{
System.Console.WriteLine(string.Format("Pages count: {0}", jbig2File.Pages.Count));
// for each page of JBIG2 file
Vintasoft.Imaging.Codecs.ImageFiles.Jbig2.Jbig2Page page;
for (int i = 0; i < jbig2File.Pages.Count; i++)
{
// show information about image of JBIG2 page
page = jbig2File.Pages[i];
System.Console.WriteLine(string.Format(" Page {0}:", i));
System.Console.WriteLine(string.Format(" - Width = {0}", page.Width));
System.Console.WriteLine(string.Format(" - Height = {0}", page.Height));
System.Console.WriteLine(string.Format(" - Resolution = {0}", page.Resolution));
}
}
}
Public Sub GetInfoAboutJbig(stream As System.IO.Stream)
' open JBIG2 file
Using jbig2File As New Vintasoft.Imaging.Codecs.ImageFiles.Jbig2.Jbig2File(stream)
System.Console.WriteLine(String.Format("Pages count: {0}", jbig2File.Pages.Count))
' for each page of JBIG2 file
Dim page As Vintasoft.Imaging.Codecs.ImageFiles.Jbig2.Jbig2Page
For i As Integer = 0 To jbig2File.Pages.Count - 1
' show information about image of JBIG2 page
page = jbig2File.Pages(i)
System.Console.WriteLine(String.Format(" Page {0}:", i))
System.Console.WriteLine(String.Format(" - Width = {0}", page.Width))
System.Console.WriteLine(String.Format(" - Height = {0}", page.Height))
System.Console.WriteLine(String.Format(" - Resolution = {0}", page.Resolution))
Next
End Using
End Sub