VintaSoft Imaging .NET SDK 15.1: Documentation for .NET developer
In This Topic
TIFF: How to merge TIFF files?
In This Topic
Here is C#/VB.NET code that shows how to add pages of one TIFF file to another:
namespace UserGuide.Programming.Tiff
{
    class MergeTIFF
    {

        public void MergeTiffFiles(System.IO.Stream firstStream, System.IO.Stream secondStream)
        {
            // open the first TIFF file
            using (Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile firstTiff = 
                new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(firstStream))
            {
                // open the second TIFF file
                using (Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile secondTiff = 
                    new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(secondStream))
                {
                    // for each page in the second TIFF file
                    for (int i = 0; i < secondTiff.Pages.Count; i++)
                    {
                        // add page of the second TIFF file to the first TIFF file
                        firstTiff.Pages.Add(secondTiff.Pages[i]);
                        // save changes to the first TIFF file
                        firstTiff.SaveChanges();
                    }
                }
            }
        }

    }
}
Namespace UserGuide.Programming.Tiff
    Class MergeTIFF

        Public Sub MergeTiffFiles(firstStream As System.IO.Stream, secondStream As System.IO.Stream)
            ' open the first TIFF file
            Using firstTiff As New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(firstStream)
                ' open the second TIFF file
                Using secondTiff As New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(secondStream)
                    ' for each page in the second TIFF file
                    For i As Integer = 0 To secondTiff.Pages.Count - 1
                        ' add page of the second TIFF file to the first TIFF file
                        firstTiff.Pages.Add(secondTiff.Pages(i))
                        ' save changes to the first TIFF file
                        firstTiff.SaveChanges()
                    Next
                End Using
            End Using
        End Sub

    End Class
End Namespace