VintaSoft Imaging .NET SDK 15.1: Документация для .NET разработчика
В этом разделе
JBIG2: Как добавить изображения в JBIG2 документ?
В этом разделе
Изображение можно добавить в JBIG2 документ несколькими способами.


Вот C#/VB.NET код, который демонстрирует, как синхронно добавлять изображения из коллекции изображений в JBIG2 файл с помощью класса Jbig2Encoder:
public void AddImagesToJbig2UsingJbig2Encoder(
    System.IO.Stream stream, 
    Vintasoft.Imaging.ImageCollection images)
{
    // add images to JBIG2 file
    using (Vintasoft.Imaging.Codecs.Encoders.Jbig2Encoder encoder = 
        new Vintasoft.Imaging.Codecs.Encoders.Jbig2Encoder(false))
    {
        // add images to JBIG2 file
        encoder.SaveImages(images, stream);
    }
}
Public Sub AddImagesToJbig2UsingJbig2Encoder(stream As System.IO.Stream, images As Vintasoft.Imaging.ImageCollection)
    ' add images to JBIG2 file
    Using encoder As New Vintasoft.Imaging.Codecs.Encoders.Jbig2Encoder(False)
        ' add images to JBIG2 file
        encoder.SaveImages(images, stream)
    End Using
End Sub


Вот C#/VB.NET код, который демонстрирует, как синхронно добавлять изображения из коллекции изображений в JBIG2 файл с помощью Класс Jbig2File:
public void AddImagesToJbig2UsingJbig2File(
    System.IO.Stream stream, 
    Vintasoft.Imaging.ImageCollection images)
{
    // open existing JBIG2 file
    using (Vintasoft.Imaging.Codecs.ImageFiles.Jbig2.Jbig2File jbig2File = 
        new Vintasoft.Imaging.Codecs.ImageFiles.Jbig2.Jbig2File(stream))
    {
        // add image to JBIG2 file
        jbig2File.Pages.Add(images);

        // save changes
        jbig2File.SaveChanges();
    }
}
Public Sub AddImagesToJbig2UsingJbig2File(stream As System.IO.Stream, images As Vintasoft.Imaging.ImageCollection)
    ' open existing JBIG2 file
    Using jbig2File As New Vintasoft.Imaging.Codecs.ImageFiles.Jbig2.Jbig2File(stream)
        ' add image to JBIG2 file
        jbig2File.Pages.Add(images)

        ' save changes
        jbig2File.SaveChanges()
    End Using
End Sub


Вот C#/VB.NET код, который демонстрирует, как синхронно добавлять изображения из коллекции изображений в JBIG2 файл с помощью классов ImageCollection и Jbig2Encoder:
public void AddImagesToJbig2UsingImageCollectionSync(
    System.IO.Stream stream, 
    Vintasoft.Imaging.ImageCollection images)
{
    // add images to JBIG2 file
    Vintasoft.Imaging.Codecs.Encoders.Jbig2Encoder encoder = 
        new Vintasoft.Imaging.Codecs.Encoders.Jbig2Encoder(false);

    // add images to JBIG2 file synchronously
    images.SaveSync(stream, encoder);

    // release resources used by encoder
    encoder.Dispose();
}
Public Sub AddImagesToJbig2UsingImageCollectionSync(stream As System.IO.Stream, images As Vintasoft.Imaging.ImageCollection)
    ' add images to JBIG2 file
    Dim encoder As New Vintasoft.Imaging.Codecs.Encoders.Jbig2Encoder(False)

    ' add images to JBIG2 file synchronously
    images.SaveSync(stream, encoder)

    ' release resources used by encoder
    encoder.Dispose()
End Sub


Вот C#/VB.NET код, который демонстрирует, как асинхронно добавлять изображения из коллекции изображений в JBIG2 файл с помощью классов ImageCollection и Jbig2Encoder:
public void AddImagesJbig2UsingImageCollectionAsync(
    System.IO.Stream stream, 
    Vintasoft.Imaging.ImageCollection images)
{
    // add images to JBIG2 file
    Vintasoft.Imaging.Codecs.Encoders.Jbig2Encoder encoder = 
        new Vintasoft.Imaging.Codecs.Encoders.Jbig2Encoder(false);

    // add images to JBIG2 file asynchronously
    images.SaveAsync(stream, encoder);
}
Public Sub AddImagesJbig2UsingImageCollectionAsync(stream As System.IO.Stream, images As Vintasoft.Imaging.ImageCollection)
    ' add images to JBIG2 file
    Dim encoder As New Vintasoft.Imaging.Codecs.Encoders.Jbig2Encoder(False)

    ' add images to JBIG2 file asynchronously
    images.SaveAsync(stream, encoder)
End Sub