VintaSoft Imaging .NET SDK 15.1: Documentation for .NET developer
In This Topic
TIFF: How to remove page from TIFF file?
In This Topic
Page of TIFF file can be removed:

Here is C#/VB.NET code that shows how to "virtually" remove page from TIFF file:
public void VirtuallyRemovePageFromTiffFile(System.IO.Stream stream, int pageIndex)
{
    // open TIFF file
    using (Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile tiff = 
        new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(stream))
    {
        // remove page at specified index
        tiff.Pages.RemoveAt(pageIndex);

        // save changes
        tiff.SaveChanges();
    }
}
Public Sub VirtuallyRemovePageFromTiffFile(stream As System.IO.Stream, pageIndex As Integer)
    ' open TIFF file
    Using tiff As New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(stream)
        ' remove page at specified index
        tiff.Pages.RemoveAt(pageIndex)

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


Here is C#/VB.NET code that shows how to "physically" remove page from TIFF file:
public void PhysicallyRemovePageFromTiffFile(
    System.IO.Stream stream, int pageIndex, System.IO.Stream outputStream)
{
    // open TIFF file
    using (Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile tiff = 
        new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(stream))
    {
        // remove page at specified index
        tiff.Pages.RemoveAt(pageIndex);

        // save modified TIFF file to the outputStream,
        // the source TIFF file is not changed
        tiff.Pack(outputStream);
    }
}
Public Sub PhysicallyRemovePageFromTiffFile(stream As System.IO.Stream, pageIndex As Integer, outputStream As System.IO.Stream)
    ' open TIFF file
    Using tiff As New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(stream)
        ' remove page at specified index
        tiff.Pages.RemoveAt(pageIndex)

        ' save modified TIFF file to the outputStream,
        ' the source TIFF file is not changed
        tiff.Pack(outputStream)
    End Using
End Sub