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
image.RemoveFrame(2)
image.Save("D:\tif\output.tif")
End Using
Note:
** I want delete multiple page also that one also need**
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
tiff.RemoveFrame(frameIndex)
'tiff.Save(retVal)
Next
tiff.Save("D:\tif\output.tif")
End If
If i give 1 and 4th pages it delete first two pages this is not correct order.
Note:
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.
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.Dispose()