Width
specifing the output PDF file width , unit is millimeter
Property Let Width As Double
No parameters
Height
specifing the output PDF file Height , unit is millimeter.
Property Let Height As Double
No parameters
ColorMode
Set the background color of the PDF file.
Property Let ColorMode As Long
No parameters
Set Colormode Value as AutoCAD colorindex.
InputFile
specifing the input drawing file that want to be conveted.
Property Let InputFile As String
No parameters
DPI
Set PDF DPI (dots per inch ) value, the default value is 100.
Property Let DPI As Long
No parameters
Example
VB script example:
Dim obj
Set obj= CreateObject("DWGTOPDFX.ConvertPDF")
obj.Width = 250 'uint is mm
obj.Height = 150 'uint is mm
obj.ColorMode = 1 '1--white&black 0--256color mode
Obj.DPI = 300
Obj.OutWithTTF = 1 '1--Convert ttf to searchable 0--Convert ttf to shape
obj.AddFontPath "D:\Program Files\AutoCAD 2005\Fonts"
obj.InputFile = "E:\tempaa\44650-39b.dwg"
obj.PsPath = "C:\Windows\system32\PS\lib;C:\Windows\system32\PS\fonts"
obj.Convert "E:\tempaa\44650-39b1.pdf"
PenWidth
specifing the pen width of the color, unit is millimetre.
Property Get/Let PenWidth(nPenWidth As Long) As Double
Example
VB script example:
Dim obj
Set obj= CreateObject("DWGTOPDFX.ConvertPDF")
obj.Width = 250 'uint is mm
obj.Height = 150 'uint is mm
obj.ColorMode = 1 '1--white&black 0--256color mode
obj.AddFontPath "D:\Program Files\AutoCAD 2005\Fonts"
obj.InputFile = "E:\tempaa\44650-39b.dwg"
obj.PenWidth(1) = .1 'set line width, unit in mm
obj.PenWidth(2) = .1 'set line width, unit in mm
obj.PenWidth(3) = .1 'set line width, unit in mm
obj.PenWidth(4) = .1 'set line width, unit in mm
obj.PenWidth(5) = .1 'set line width, unit in mm
obj.PsPath = "C:\Windows\system32\PS\lib;C:\Windows\system32\PS\fonts"
obj.Convert "E:\tempaa\44650-39b1.pdf"
PsPath
specified the ps path.
Property Let PsPath As String
No parameters
Must setting PsPath before using convert method.
AddFontPath
Add a directory to the folder list in which DWG2PDFX searches for shx font file.
Sub AddFontPath(szFontPath As String)
Example
VB script example:
Dim obj
Set obj= CreateObject("DWGTOPDFX.ConvertPDF")
obj.Width = 250 'uint is mm
obj.Height = 150 'uint is mm
obj.ColorMode = 1 '1--white&black 0--256color mode
obj.AddFontPath "D:\Program Files\AutoCAD 2005\Fonts"
obj.InputFile = "E:\tempaa\44650-39b.dwg"
obj.PenWidth(1) = .1 'set line width, unit in mm
obj.PenWidth(2) = .1 'set line width, unit in mm
obj.PenWidth(3) = .1 'set line width, unit in mm
obj.PenWidth(4) = .1 'set line width, unit in mm
obj.PenWidth(5) = .1 'set line width, unit in mm
obj.PsPath = "C:\Windows\system32\PS\lib;C:\Windows\system32\PS\fonts"
obj.Convert "E:\tempaa\44650-39b1.pdf"
ViewCount
Get the drawing's layout count.
Property Get ViewCount As Long
No parameters
Use Viewcount after the method InputFile.
Example
VB script example:
Dim objImage
Set objImage = CreateObject("DWGTOPDFX.ConvertPDF")
objImage.Width = 1024
objImage.Height = 768
'objImage.Background = 0
objImage.InputFile = "d:\aa.dwg" '"8th floor furniture.dwg"
objImage.Convert "e:\testa.pdf"
For I=1 to objImage.ViewCount
strViewName = objImage.ViewName(I)
strOutput = strViewName&".pdf" 'output file name, include path
objImage.ConvertView strOutput, strViewName
Next
If Err.Number < 0 Then
MsgBox Err.Description
End If
ViewName
Get layout name by layout index.
Property Get ViewName(nIndex As Long) As String
Use Viewcount after the method InputFile.
Convert
Convert the drawing merge all layout into a single PDF file.
Sub Convert(szoutFile As String)
ConvertView
Convert specified layout in the drawing to PDF file.
Sub ConvertView(szOutputFileName As String, view)
Use convertView after the method InputFile.