Proe4.0使用VB.net生成缩略图方法

Private Sub btnRasterImage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRasterImage.Click
        Dim run As New pfcInterfaceExamples2
        Dim type As EpfcRasterType
        Try
            lblStatus.Text = ""
            If (txtImageFile.Text = "") Then
                MsgBox("Please enter Image File name", MsgBoxStyle.Critical)
            ElseIf (txtImageType.Text = "") Then
                MsgBox("Please select Image type", MsgBoxStyle.Critical)
            Else
                Select Case txtImageType.Text
                    Case "BMP"
                        type = EpfcRasterType.EpfcRASTER_BMP
                    Case "JPEG"
                        type = EpfcRasterType.EpfcRASTER_JPEG
                    Case "TIFF"
                        type = EpfcRasterType.EpfcRASTER_TIFF
                    Case "EPS"
                        type = EpfcRasterType.EpfcRASTER_EPS
                    Case Else
                        MsgBox("Incorrect Image type", MsgBoxStyle.Critical)
                        Exit Sub
                End Select

                run.outputImageScreen(asyncConnection.Session, type, txtImageFile.Text)
                lblStatus.Text = "Image Created"

            End If
        Catch ex As Exception
            lblStatus.Text = ""
            MsgBox(ex.Message.ToString + Chr(13) + ex.StackTrace.ToString)
        End Try
    End Sub

Public Sub outputImageScreen(ByRef session As IpfcBaseSession, _
                                 ByVal type As Integer, _
                                 ByVal imageName As String)
        Dim instructions As IpfcRasterImageExportInstructions
        Dim imageExtension As String
        Dim rasterHeight As Double = 7.5
        Dim rasterWidth As Double = 10.0
        Dim dotsPerInch As Integer
        Dim imageDepth As Integer

        Try
            dotsPerInch = EpfcDotsPerInch.EpfcRASTERDPI_100
            imageDepth = EpfcRasterDepth.EpfcRASTERDEPTH_24

            instructions = getRasterInstructions(type, rasterWidth, _
                                                 rasterHeight, dotsPerInch, _
                                                 imageDepth)

            imageExtension = getRasterExtension(type)

            session.ExportCurrentRasterImage(imageName + imageExtension, instructions)

        Catch ex As Exception
            MsgBox(ex.Message.ToString + Chr(13) + ex.StackTrace.ToString)
        End Try
    End Sub

作者:Joe.Fan
         
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
原文地址:https://www.cnblogs.com/fanxingthink/p/4176160.html