您好,
以前是否有人遇到过此错误并知道它的含义?当试图生成PDF时,这是在这行代码中发生的
- pe.BeginGenerateGraphics(Nothing)
完整代码:
- Try
- Dim layMgr As LayoutManager = LayoutManager.Current
- Dim loObjId As ObjectId = layMgr.GetLayoutId(layMgr.CurrentLayout)
- Dim lo As Layout = DirectCast(tr.GetObject(loObjId, OpenMode.ForRead), Layout)
- Dim ps As New PlotSettings(lo.ModelType)
- ps.CopyFrom(lo)
- Dim pi As New PlotInfo()
- pi.Layout = loObjId
- Dim psv As PlotSettingsValidator = Autodesk.AutoCAD.DatabaseServices.PlotSettingsValidator.Current
- psv.SetPlotConfigurationName(ps, "DWG To PDF.pc3", "ANSI_B_(11.00_x_17.00_Inches)")
- psv.RefreshLists(ps)
- psv.SetPlotType(ps, Autodesk.AutoCAD.DatabaseServices.PlotType.Extents)
- psv.SetUseStandardScale(ps, True)
- psv.SetStdScaleType(ps, StdScaleType.ScaleToFit)
- pi.OverrideSettings = ps
- Dim pe As PlotEngine = PlotFactory.CreatePublishEngine()
- Try
- pe.BeginPlot(Nothing, Nothing)
- Dim validator As New PlotInfoValidator()
- validator.MediaMatchingPolicy = Autodesk.AutoCAD.PlottingServices.MatchingPolicy.MatchEnabled
- validator.Validate(pi)
- 'Dim plotFile As String = Path.GetFullPath(Application.DocumentManager.MdiActiveDocument.Database.Filename)
- Dim plotFile As String = Path.GetFullPath(doc2.Name)
- plotFile = plotFile.Remove(plotFile.Length - 4)
- pe.BeginDocument(pi, doc.Name, Nothing, 1, True, plotFile & ".pdf")
- Dim pageInfo As New PlotPageInfo()
- pe.BeginPage(pageInfo, pi, True, Nothing)
- pe.BeginGenerateGraphics(Nothing)
- pe.EndGenerateGraphics(Nothing)
- pe.EndPage(Nothing)
- pe.EndDocument(Nothing)
- pe.EndPlot(Nothing)
- Catch ex As System.Exception
- Windows.MessageBox.Show(ex.Message)
- End Try
- pe.Destroy()
- tr.Commit()
- Catch ex As System.Exception
- Windows.MessageBox.Show(ex.Message)
- End Try
感谢您的帮助,
-Ted
本帖以下内容被隐藏保护;需要你回复后,才能看到! 游客,如果您要查看本帖隐藏内容请 回复 |