DWG2ImageX
DWG2ImageX is an ActiveX control let you convert DWG/DXF/DWF file into GIF, JPEG, BMP, PNG directly, without need of AutoCAD.
Sample Code
Dim objImage
On Error Resume Next
Set objImage= CreateObject("DWG2ImageX.Converter")
objImage.Width = 1024
objImage.Height = 768
objImage.ImageFormat = 2 '1--jpeg, 2--gif
objImage.InputFile = "c:\My Drawings\8th floor furniture.dwg"
MsgBox objImage.Version 'Get the drawing file version.
MsgBox "Total "& objImage.ViewCount &" Views"
For I=1 to objImage.ViewCount
strViewName = objImage.ViewName(I)
MsgBox "Converting view: "& strViewName& "..."
nWidth = objImage.ViewWidth(I)
nHeight= objImage.ViewHeight(I)
MsgBox "Width="&nWidth&" Height="&nHeight
strOutput = "c:\Output\"&strViewName
objImage.Convert strOutput, strViewName
Next
If Err.Number < 0 Then
MsgBox Err.Description
End If
Properties
InputFile Specify the file to be converted.
Width Set output image width in pixels.
Height Set output image height in pixels.
Background Set background of output image.
ImageFormat Set output image format.
ZoomType Set zoom type.
ViewCount Get the views count in the drawing file.
ViewName Get the view name by index.
ViewWidth Get the view width by index.
ViewHeight Get the view height by index.
Version Get version of the file.
Methods
Convert Convert the drawing file to a Image file.
AddFontPath Add AutoCAD font support path.
Version Support:
From AutoCAD R9 files to current version AutoCAD 2010 files;
Support Languages:
Any programming languages that supports COM, such as Visual C++, VB, Delphi, FoxPro, VBScript,JavaScript and etc.