Copy Pages Sample
Copy Pages Sample
I am trying to copy a range of pages from one multi-page tiff into a new multi-page tiff. Is this possible? I am able to get a single page saved, but can seems to create a file with multiple pages. Is there sample code for this anywhere?
Re: Copy Pages Sample
Hi,
Here a function to extract a page range from a multipage tiff to another multipage tiff image:
Kind regards,
Loïc
Here a function to extract a page range from a multipage tiff to another multipage tiff image:
Code: Select all
Private Function ExtractPageRange(ByVal ImageSrcPath As String, ByVal ImageDstPath As String, ByVal StartPage As Integer, ByVal EndPage As Integer) As GdPictureStatus
Dim Status As GdPictureStatus
Dim oGdPictureImaging As New GdPictureImaging
Dim ImageSrcID As Integer
Dim ImageDstID As Integer = 0
oGdPictureImaging.SetLicenseNumber("XXX") 'Replace XXX by your license KEY
oGdPictureImaging.TiffOpenMultiPageForWrite(False)
ImageSrcID = oGdPictureImaging.CreateGdPictureImageFromFile(ImageSrcPath)
Status = oGdPictureImaging.GetStat
If Status = GdPictureStatus.OK Then
For I As Integer = StartPage To EndPage
Status = oGdPictureImaging.TiffSelectPage(ImageSrcID, I)
If ImageDstID = 0 Then
ImageDstID = oGdPictureImaging.TiffCreateMultiPageFromGdPictureImage(ImageSrcID)
Else
oGdPictureImaging.TiffAppendPageFromGdPictureImage(ImageDstID, ImageSrcID)
End If
Next
Status = oGdPictureImaging.TiffSaveMultiPageToFile(ImageDstID, ImageDstPath, TiffCompression.TiffCompressionCCITT4)
oGdPictureImaging.ReleaseGdPictureImage(ImageDstID)
oGdPictureImaging.ReleaseGdPictureImage(ImageSrcID)
End If
Return Status
End Function
Loïc
Who is online
Users browsing this forum: No registered users and 2 guests