zoukankan      html  css  js  c++  java
  • Proe 导出PDF Vb.net

    Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
            Dim instructions As IpfcPDFExportInstructions
            Dim CoCreoSession As IpfcBaseSession
            Dim outPath As String
            
            Try
                Dim run As New pfcModelsExamples
                asyncConnection = Casync.Connect(DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value)
                CoCreoSession = asyncConnection.Session
    
                Dim descModel As IpfcModelDescriptor
                descModel = (New CCpfcModelDescriptor).Create(EpfcModelType.EpfcMDL_DRAWING, Nothing, Nothing)
                descModel.Path = "C:Documents and SettingsAdministratorMy Documentsdrw0001.drw.1"
    
                'Dim LmodDoc As IpfcModel = CoCreoSession.GetModelFromDescr(descModel)
                Dim LmodDoc As IpfcModel = retrieveModelFromStdDir(CoCreoSession, EpfcModelType.EpfcMDL_DRAWING, "C:Documents and SettingsAdministratorMy Documentsdrw0001.drw.1")
    
    
                If Not LmodDoc Is Nothing Then
                    LmodDoc.Display()
                    CoCreoSession.CurrentWindow.Activate()
                End If
    
                instructions = (New CCpfcPDFExportInstructions).Create()
    
                outPath = "c:work" + LmodDoc.InstanceName.ToLower + ".pdf"
                LmodDoc.Export(outPath, instructions)
                If Not LmodDoc Is Nothing Then CoCreoSession.CurrentWindow.Close()
            Catch ex As Exception
                MsgBox(ex.Message & vbNewLine & ex.StackTrace)
            End Try
        End Sub
    
        Public Function retrieveModelFromStdDir(ByVal session As IpfcBaseSession, _
                                                ByVal type As EpfcModelType, _
                                                ByVal stdPath As String) As IpfcModel
    
            Dim descModel As IpfcModelDescriptor
            Dim options As IpfcRetrieveModelOptions
            Dim model As IpfcModel
    
            Try
                '======================================================================
                'Model is retrieved using a model descriptor object.
                'This method loads the model identified by model type and path from a 
                'standard directory location.
                '======================================================================
                options = (New CCpfcRetrieveModelOptions).Create
                options.AskUserAboutReps = False
    
                descModel = (New CCpfcModelDescriptor).Create(type, Nothing, Nothing)
                descModel.Path = stdPath
    
                model = session.RetrieveModelWithOpts(descModel, options)
    
                retrieveModelFromStdDir = model
    
            Catch ex As Exception
                MsgBox(ex.Message.ToString + Chr(13) + ex.StackTrace.ToString)
                Return Nothing
            End Try
    
        End Function


     

    作者:Joe.Fan
             
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    hive、sqoop、MySQL间的数据传递
    centos7配置Hadoop集群环境
    crontab定时时间解释
    Jmeter小技巧以及问题集合
    【总结】梳理下接口功能测试
    【部署问题】解决Nginx: [error] open() "/usr/local/Nginx/logs/Nginx.pid" failed(2:No such file or directory)
    【C#公共帮助类】 ToolsHelper帮助类
    【C#公共帮助类】枚举独特类
    【无私分享:从入门到精通ASP.NET MVC】从0开始,一起搭框架、做项目(4)对前面的一些问题汇总和总结
    【C#公共帮助类】分页逻辑处理类
  • 原文地址:https://www.cnblogs.com/fanxingthink/p/4176151.html
Copyright © 2011-2022 走看看