彩票走势图

GdPicture.NET使用教程:旋转页面并保存覆盖原始的PDF

原创|其它|编辑:郝浩|2012-12-21 14:26:46.000|阅读 420 次

概述:在使用GdPicture.NET控件的时候,如果想旋转页面并保存覆盖原有的PDF文件,就需要用到其中的rasterisation方法。

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

相关链接:

在使用GdPicture.NET控件的时候,如果想旋转页面并保存覆盖原有的PDF文件,就需要用到其中的rasterisation方法,这包括处理所有输入PDF位图的页面,并将这些位图添加到新的PDF文件中。

》》》下载GdPicture.NET最新试用版

代码如下:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim oGdPictureImaging As New GdPicture.GdPictureImaging
        Dim oGdViewer As New GdPicture.GdViewer
        Dim RasterizedPage As Integer
        Dim PdfID As Integer
        Dim PdfImageID As Integer
        Dim CurrentPageWidth, CurrentPageHeight As Single

        oGdPictureImaging.SetLicenseNumber("XXX") 'Unlocking GdPicture.NET -> Replace XXX by a commercial or demo license KEY

        If oGdViewer.DisplayFromFile("c:\test.pdf") = GdPictureStatus.OK Then
            PdfID = oGdPictureImaging.PdfNewPdf("c:\newpdf.pdf", True) 'PDF/A
            'Adding all rasterized pages of first to output PDF
            For i As Integer = 1 To oGdViewer.PageCount
                RasterizedPage = oGdViewer.PdfRenderPageToGdPictureImage(200, i)
                If i = 2 Then 'page to rotate !!
                    oGdPictureImaging.Rotate(RasterizedPage, RotateFlipType.Rotate90FlipNone)
                End If
                PdfImageID = oGdPictureImaging.PdfAddImageFromGdPictureImage(PdfID, RasterizedPage)
                oGdPictureImaging.ReleaseGdPictureImage(RasterizedPage)
                'Drawing the image into a PDF page
                CurrentPageWidth = oGdPictureImaging.PdfGetImageWidth(PdfID, PdfImageID)
                CurrentPageHeight = oGdPictureImaging.PdfGetImageHeight(PdfID, PdfImageID)
                oGdPictureImaging.PdfNewPage(PdfID, CurrentPageWidth, CurrentPageHeight)
                oGdPictureImaging.PdfDrawImage(PdfID, PdfImageID, 0, 0, CurrentPageWidth, CurrentPageHeight)
            Next
            oGdViewer.CloseDocument()
            oGdPictureImaging.PdfEndPdf(PdfID)
        End If
    End Sub


标签:

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

文章转载自:慧都控件网

为你推荐

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


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP