You can either use AutoCAD .NET API, or COM API /AutoCAD VBA plot drawing programmatically,using the "PublishToWeb PNG.pc3" as plotting device.
For example, this simple code sample plot the active layout to a *.png file:
Option Explicit
Public Sub PrintToPng()
Dim pngFile As String
pngFile = "C:\Temp\Test.png"
Dim layout As AcadLayout
Set layout = ThisDrawing.ActiveLayout
layout.ConfigName = "PublishToWeb PNG.pc3"
Dim result As Boolean
result = ThisDrawing.Plot.PlotToFile(pngFile)
If result Then
MsgBox "Plotting to PNG file succeeded."
Else
MsgBox "Plotting to PNG file failed."
End If
End Sub
It is pretty simple, if the active layout's plot configuration is properly set (paper size, plot scale...). Of course, you can also programmatically set up plotting configuration to the layout your want to plot before the plotting is actually done.
With AutoCAD .NET API, you may have event more controls on how the plotting is done.
Programmatic plotting is one of most discussed topics on AutoCAD customization programming. For using COM API to plot, you can search this forum, or browse AutoCAD VBA help document for details and sample code; for using AutoCAD .NET API, you can search the .NET forum and online AutoCAD developer guide.
Without knowing your programming knowledge/skill on AutoCAD, I am going into more details. When you actually run into coding issue, feel free to post your code and ask comments/advises.