彩票走势图

GdPicture.NET文件转换教程连载:将多页TIFF文件的一部分转换成PDF

原创|其它|编辑:郝浩|2012-12-28 09:38:47.000|阅读 323 次

概述:本文将要告诉你如何将多页TIFF文件的一部分转换成PDF的具体示例

# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>

相关链接:

以前发布的一篇教程曾经提到过怎样将多页TIFF文件转换成PDF文件,但是那种方法只适用于整个多页TIFF文件的转换,作为上一篇教程的补充,本文将要给出的是如何将多页TIFF文件的一部分转换成PDF的具体示例。

>>>下载GdPicture.NET

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Imaging1 As New GdPicture.GdPictureImaging
        Call Imaging1.SetLicenseNumber("XXX") 'Please, replace XXXX by a valid demo or commercial license key. 
        'Go to //evaluation-gdpicture.com to get a 1 month trial key unlocking all features of the toolkit.

        Imaging1.TiffOpenMultiPageForWrite(False)
        Dim ImageID As Integer = Imaging1.CreateGdPictureImageFromFile("c:\multipage.tif")
        Dim PdfID As Integer = Imaging1.PdfNewPdf("c:\multipage.pdf", True) 'True for creating PDF/A compliant. Use False for non PDF/A
        Dim ImageCount As Integer = 0
        Dim ImageHeight, ImageWidth As Single

        'We add desired pages to the PDF
        For i As Integer = 1 To Imaging1.TiffGetPageCount(ImageID)
            If i <> 1 And i <> 3 Then ' We don't want page 1 & 3
                Imaging1.TiffSelectPage(ImageID, i)
                Imaging1.PdfAddImageFromGdPictureImage(PdfID, ImageID)
                ImageCount += 1
            End If
        Next i

        Imaging1.ReleaseGdPictureImage(ImageID) 'We can now release the multipage tiff from the memory

        'Now drawing all images of the PDF on individual pages
        For p As Integer = 1 To ImageCount
            ImageHeight = Imaging1.PdfGetImageHeight(PdfID, p)
            ImageWidth = Imaging1.PdfGetImageWidth(PdfID, p)
            Imaging1.PdfNewPage(PdfID, ImageWidth, ImageHeight)
            Imaging1.PdfDrawImage(PdfID, p, 1, 1, ImageWidth, ImageHeight)
        Next

        Imaging1.PdfEndPdf(PdfID) 'Closing PDF

        MsgBox("Done !")
    End Sub

标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@pclwef.cn

文章转载自:慧都控件网

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP