原創(chuàng)|其它|編輯:郝浩|2012-12-17 09:41:33.000|閱讀 605 次
概述:使用GdPicture.NET可對圖像掃描后進(jìn)行簡單的處理,比如將PDF文件轉(zhuǎn)換成多頁的TIFF文件,本文將給出該示例的代碼。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
使用GdPicture.NET可對圖像掃描后進(jìn)行簡單的處理,比如將PDF文件轉(zhuǎn)換成多頁的TIFF文件,本文將給出該示例的代碼。
示例代碼如下:
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
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@ke049m.cn
文章轉(zhuǎn)載自:慧都控件網(wǎng)