Hi,
Has anyone ran across this error before and know what it means? It's happening at this line of code when trying to generate a PDF.
pe.BeginGenerateGraphics(Nothing)
Full Code:
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
Thanks for any help,
-Ted