How to delete the particular page in tif file


        I want to delete the particular page in tif file. i use the below code to delete the page

for example i have tif with 19 pages i want to delete the 2nd page but it delete the 3rd page in tif file.

Dim oldfile As String = “D:\tif\CCITT_1.tif”

    Using image As TiffImage = DirectCast(Aspose.Imaging.Image.Load(oldfile), TiffImage)
        Dim frame As TiffFrame = Nothing

    End Using

** I want delete multiple page also that one also need**


Can you please share source file so that we may further investigate to help you out.


         Thank for reply i send source file


I suggest you to please visit the following thread link for your kind reference.


  Thanks for reply in pdf and tif i  delete the multiple page.

for example:
Dim oldfile1 As String = “D:\tif1\doc1.pdf”
Dim oldfile As String = “D:\tif1\CCITT_1.tif”
Dim TeamIndex() As Integer = {1, 4}
for Pdf:

Dim pdfEditor As New PdfFileEditor()

                pdfEditor.Delete(oldfile1, TeamIndex,D:\tif\output1.pdf")

it delete the particular 1 and 4th pages

for tif:
Dim frameIndex As Integer = 0
Dim tiff As TiffImage = DirectCast(Aspose.Imaging.Image.Load(oldfile), TiffImage)

    If tiff.Frames.Length > 1 Then
        For i As Integer = 0 To TeamIndex.Count() - 1
            If frameIndex = 0 Then
                tiff.ActiveFrame = tiff.Frames(frameIndex + 1)
            End If

    End If

If i give 1 and 4th pages it delete first two pages this is not correct order.


Like pdf we want to delete particular page 1 and 4


I have observed the sample code shared by you and there seems to be no issue. I request you to please share the source file and generated output with us that I may investigate on my end to help you further.


         Pls refer above already i send the source file.

image.png (7.2 KB)


I have worked with source file and sample code shared by you. I like to inform that pages is numbered from 0 not from 1. That is why you need delete pages 0 and 3.

Dim tiff As TiffImage = DirectCast(Aspose.Imaging.Image.Load(oldfile), TiffImage)

tiff.ActiveFrame = TiffImage.Frames(1)

Dim frame = TiffImage.RemoveFrame(3); ’ delete page 4

frame = TiffImage.RemoveFrame(0); ’ delete page 1