' Changes the plot settings for a layout directly
Public Sub ChangeLayoutPlotSettings()
' Get the current document and database, and start a transaction
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
' Reference the Layout Manager
Dim acLayoutMgr As LayoutManager = LayoutManager.Current
' Get the current layout and output its name in the Command Line window
Dim acLayout As Layout = _
acTrans.GetObject(acLayoutMgr.GetLayoutId(acLayoutMgr.CurrentLayout), OpenMode.ForRead)
' Output the name of the current layout and its device
acDoc.Editor.WriteMessage(vbLf & "Current layout: " & acLayout.LayoutName)
acDoc.Editor.WriteMessage(vbLf & "Current device name: " & acLayout.PlotConfigurationName)
' Get a copy of the PlotSettings from the layout
Using acPlSet As PlotSettings = New PlotSettings(acLayout.ModelType)
acPlSet.CopyFrom(acLayout)
' Update the PlotConfigurationName property of the PlotSettings object
Dim acPlSetVdr As PlotSettingsValidator = PlotSettingsValidator.Current
acPlSetVdr.SetPlotConfigurationName(acPlSet, "DWG To PDF.pc3", "ANSI_B_(11.00_x_17.00_Inches)")
acPlSetVdr.SetPlotConfigurationName(acPlSet, "DocuPrint 3100", "A3 (297x420mm)")
' Zoom to show the whole paper
acPlSetVdr.SetZoomToPaperOnUpdate(acPlSet, True)
' Update the layout
acLayout.UpgradeOpen()
acLayout.CopyFrom(acPlSet)
End Using
' Output the name of the new device assigned to the layout
acDoc.Editor.WriteMessage(vbLf & "New device name: " & acLayout.PlotConfigurationName)
' Save the new objects to the database
acTrans.Commit()
End Using
' Update the display
acDoc.Editor.Regen()
End Sub
acPlSetVdr.SetPlotConfigurationName(acPlSet, "DWG To PDF.pc3", "ANSI_B_(11.00_x_17.00_Inches) ")
Then I do not have any problem,
Of print environment using in us
acPlSetVdr.SetPlotConfigurationName(acPlSet, "DocuPrint 3100 ", "A3 (297x420mm) ")
When I carry out
By einvalidinput error, a command is terminated abnormally.
When I carry this out,
Current device name: DocuPrint 3100
Because I appear, must be a Device name.
Please teach a cause, measures.
Thanking you in advance.