JBIG2: Как объединить JBIG2-документы?
В этом разделе
Вот C#/VB.NET код, который демонстрирует, как объединить несколько JBIG2-документов в один JBIG2-документ:
public void MergeJbig2Files(System.IO.Stream firstStream, System.IO.Stream secondStream)
{
// open the first JBIG2 file
using (Vintasoft.Imaging.Codecs.ImageFiles.Jbig2.Jbig2File firstJbig2File =
new Vintasoft.Imaging.Codecs.ImageFiles.Jbig2.Jbig2File(firstStream))
{
// open the second JBIG2 file
using (Vintasoft.Imaging.Codecs.ImageFiles.Jbig2.Jbig2File secondJbig2File =
new Vintasoft.Imaging.Codecs.ImageFiles.Jbig2.Jbig2File(secondStream))
{
// for each page in the second JBIG2 file
for (int i = 0; i < secondJbig2File.Pages.Count; i++)
{
// add page of the second JBIG2 file to the first JBIG2 file
firstJbig2File.Pages.Add(secondJbig2File.Pages[i]);
}
// save changes to the first TIFF file
firstJbig2File.SaveChanges();
}
}
}
Public Sub MergeJbig2Files(firstStream As System.IO.Stream, secondStream As System.IO.Stream)
' open the first JBIG2 file
Using firstJbig2File As New Vintasoft.Imaging.Codecs.ImageFiles.Jbig2.Jbig2File(firstStream)
' open the second JBIG2 file
Using secondJbig2File As New Vintasoft.Imaging.Codecs.ImageFiles.Jbig2.Jbig2File(secondStream)
' for each page in the second JBIG2 file
For i As Integer = 0 To secondJbig2File.Pages.Count - 1
' add page of the second JBIG2 file to the first JBIG2 file
firstJbig2File.Pages.Add(secondJbig2File.Pages(i))
Next
' save changes to the first TIFF file
firstJbig2File.SaveChanges()
End Using
End Using
End Sub