• VB Net =》DxF 转 PDF DxF 显示 PDF 预览


        Public Sub Dwg2Pdf(ByVal files As List(Of FileInfo))
    
            If files.Count = 0 Then
                Return
            End If
            Dim doc As AcadDocument = Nothing
            Dim destPath As String = String.Empty
            'InitializationApp()
    
            Dim activeDoc As Document = Application.DocumentManager.MdiActiveDocument
            'Dim ThisDrawing As AcadDocument = CType(activeDoc.AcadDocument, AcadDocument)
    
    
    
    
            Try
    
                For Each f In files
                    If File.Exists(f.FullName) = False Then
                        Continue For
                    End If
                    'doc = _app.Documents.Open(f.FullName, True)
                    doc = Application.DocumentManager.Open(f.FullName, True).AcadDocument
                    'doc = ThisDrawing.Open(f.FullName, True)
                    'ThisDrawing.LoadShapeFile(f.FullName)
    
                    'doc = ThisDrawing
    
                    doc.SetVariable("sdi", 0)
                    doc.SetVariable("Filedia", 0)
                    doc.SetVariable("RASTERPREVIEW", 1)
                    doc.SetVariable("BACKGROUNDPLOT", 0)
                    doc.ActiveLayout.ConfigName = "DWG To PDF.pc3"
                    doc.ActiveLayout.UseStandardScale = True
                    doc.ActiveLayout.StandardScale = AcPlotScale.acScaleToFit
                    doc.ActiveLayout.PlotType = AcPlotType.acExtents
                    doc.ActiveLayout.CenterPlot = True
                    doc.ActiveLayout.PlotRotation = AcPlotRotation.ac0degrees
                    doc.ActiveLayout.PlotType = Common.AcPlotType.acExtents
                    doc.Plot.QuietErrorMode = True
                    destPath = Path.Combine(f.Directory.FullName, Path.GetFileNameWithoutExtension(f.Name) & ".pdf")
                    doc.Plot.PlotToFile(destPath)
                    If doc IsNot Nothing Then doc.Close(False)
                Next
    
            Catch e As System.Exception
                Throw e
            Finally
    
                Try
                    doc.Close(False)
                    '_app.Quit()
                Catch
                End Try
            End Try
        End Sub
  • 相关阅读:
    java01 java基础知识
    01 开发准备 启动PHP服务与环境配置
    Axure 9.0 使用教程2-函数分类
    Axure 9.0 使用教程1-软件概述
    Python 字符串 列表 元组 字典 集合学习总结
    Python 函数定义 调用 迭代器 生成器 递归和推导式
    Python习题
    Python 条件 循环 及其他语句
    Python 字典
    Python 字符串
  • 原文地址:https://www.cnblogs.com/shangdishijiao/p/12849704.html
Copyright © 2020-2023  润新知