Converting PDF to multipage TIFF with GdPicture.NET 8
Posted: Wed Jul 06, 2011 11:13 am
Here an example of how to use GdPicture.NET 8 to convert multipage PDF to multipage TIFF.
Code: Select all
Dim oGdPictureImaging As New GdPictureImaging()
Dim oGdPicturePDF As New GdPicturePDF
If oGdPicturePDF.LoadFromFile("c:\test.pdf", False) = GdPictureStatus.OK Then
Dim TiffID As Integer
For i As Integer = 1 To oGdPicturePDF.GetPageCount()
oGdPicturePDF.SelectPage(i)
Dim RasterPageID As Integer = oGdPicturePDF.RenderPageToGdPictureImageEx(200, True) '200 DPI rendering with form fields, or native image extraction if the page is image based
'Convert rendered page to bitonal
oGdPictureImaging.ConvertTo1Bpp(RasterPageID) 'Remove this line if you want to obtain colour tiff image
If i = 1 Then
TiffID = RasterPageID
oGdPictureImaging.TiffSaveAsMultiPageFile(TiffID, "c:\multipage.tif", TiffCompression.TiffCompressionAUTO)
Else
oGdPictureImaging.TiffAddToMultiPageFile(TiffID, RasterPageID)
End If
oGdPictureImaging.ReleaseGdPictureImage(RasterPageID)
Next
oGdPictureImaging.TiffCloseMultiPageFile(TiffID)
oGdPicturePDF.CloseDocument()
MsgBox("Done!")
Else
MsgBox("can't open PDF")
End If