VintaSoft Imaging .NET SDK 12.4: Documentation for .NET developer
In This Topic
    JBIG2: How to get information about JBIG2 document?
    In This Topic
    Here is C#/VB.NET code that shows how to get information about JBIG2 document:
    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