利用GdPicture.NET实现多页TIFF文件的页面的添加

Posted on 2015-12-09 15:16  Rforyou  阅读(638)  评论(0编辑  收藏  举报

GdPicture.NET是一款功能全面且可无限分发的文档图像处理的一体化工具包。其一体化主要包含:PDF、图像处理、文档影像、扫描、条形码、打印、OCR、表单处理、注释等。本文将简单介绍在GdPicture.NET中多页TIFF文件的页面的添加。

这里讲提供三种方法,给出了代码可供参考:

1、末尾的添加

Dim oGdPictureImaging As New GdPictureImaging
Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("multipage.tif")
oGdPictureImaging.TiffAppendPageFromFile(ImageID, "addition.tif")
oGdPictureImaging.TiffSaveMultiPageToFile(ImageID, "multipageAdded.tif", TiffCompression.TiffCompressionAUTO)

oGdPictureImaging.ReleaseGdPictureImage(ImageID)

可用上面相同的方法添加一个页面保存为GdPictureImage

Dim oGdPictureImaging As New GdPictureImaging
Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("multipage.tif")
Dim AddImgID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("addition.tif")
oGdPictureImaging.TiffAppendPageFromGdPictureImage(ImageID, AddImgID)
oGdPictureImaging.TiffSaveMultiPageToFile(ImageID, "multipageAdded.tif", TiffCompression.TiffCompressionAUTO)
oGdPictureImaging.ReleaseGdPictureImage(ImageID)
oGdPictureImaging.ReleaseGdPictureImage(AddImgID)

2、通过创建TiffSaveAsMultiPageFile()方法将页面到文件末尾

Dim oGdPictureImaging As New GdPictureImaging
Dim ImageID, TiffID As Integer
ImageID = oGdPictureImaging.CreateGdPictureImageFromFile("image1.tif")
oGdPictureImaging.TiffSaveAsMultiPageFile(ImageID, "multipage.tif", TiffCompression.TiffCompressionAUTO)
'At this step ImageID1 handles a reference to the multipage tiff stream.
TiffID = ImageID
'adding a second page in the multipage stream from image2.tif
ImageID = oGdPictureImaging.CreateGdPictureImageFromFile("image2.tif")
oGdPictureImaging.TiffAddToMultiPageFile(TiffID, ImageID)
oGdPictureImaging.ReleaseGdPictureImage(ImageID)
oGdPictureImaging.ReleaseGdPictureImage(ImageID)
oGdPictureImaging.TiffCloseMultiPageFile(TiffID) 'end the file
oGdPictureImaging.ReleaseGdPictureImage(TiffID) 'releasing the input bitmap from the memory

3、任意位置的添加

Dim oGdPictureImaging As New GdPictureImaging
Dim ImageID As Integer
ImageID = oGdPictureImaging.CreateGdPictureImageFromFile("multipage.tif")
oGdPictureImaging.TiffInsertPageFromFile(ImageID, 3, "addition.tif")
oGdPictureImaging.TiffSaveMultiPageToFile(ImageID, "multipageAdded.tif", TiffCompression.TiffCompressionAUTO)
oGdPictureImaging.ReleaseGdPictureImage(ImageID)
Dim oGdPictureImaging As New GdPictureImaging
Dim ImageID As Integer
Dim AddImgID As Integer
ImageID = oGdPictureImaging.CreateGdPictureImageFromFile("multipage.tif")
AddImgID = oGdPictureImaging.CreateGdPictureImageFromFile("addition.tif")
oGdPictureImaging.TiffInsertPageFromGdPictureImage(ImageID, 3, AddImgID)
oGdPictureImaging.TiffSaveMultiPageToFile(ImageID, "multipageAdded.tif", TiffCompression.TiffCompressionAUTO)
oGdPictureImaging.ReleaseGdPictureImage(ImageID)
oGdPictureImaging.ReleaseGdPictureImage(AddImgID)

我可以看到其基本方法:Add—Save—Released

产品详情evget.com/product/1947