title: How to convert dwg file of autocad to png format using python ,Is there is any way?
body: <p>Is there any way to change dwg file AutoCAD to png format or pdf format using python.</p>
  
  <p>I tried looking many documentation none of them answered my question</p>
  
  <pre><code>```
  from __future__ import print_function
  from os.path import join, dirname, abspath
  from xlutils.copy import copy
  import xlrd
  import xlwt
  from pyautocad import Autocad, APoint
  import os
  import win32com.client
  from pyautocad import Autocad, APoint
  from pyautocad.contrib.tables import Table
  from comtypes import COMError
  def props(cls):
    return [i for i in cls.__dict__.keys() if i[:1] != '_']
  # Create workbook
  book = xlwt.Workbook()
  ws = book.add_sheet("ExportedData")
  book.save("Exported.xls")
  
  # Open the workbook
  xl_workbook = xlrd.open_workbook("Exported.xls")
  sheet_names = xl_workbook.sheet_names()
  
  xl_sheet = xl_workbook.sheet_by_name(sheet_names[0])
  
  wb = copy(xl_workbook)
  sheet = wb.get_sheet(0)
  
  dwgfiles = filter(os.path.isfile, os.listdir(os.curdir))
  
  
  
  cwd = os.path.abspath(os.path.curdir)  # current working dir
  print(cwd)
  
  
  for f in dwgfiles:
      print("++++++++++++++++++++++++++++++")
      print("++++++++++++++++++++++++++++++")
      print("++++++++++++++++++++++++++++++")
      print("++++++++++++++++++++++++++++++")
  
      print(f)
      if f.endswith(".dwg"):
          print("sdaasdas")
          """ open Document"""
          acad = Autocad()
          print(cwd)
          acad.app.Documents.open(cwd + "/" + f)
          exportFile="new2.bmp"
  
  
  
  
  
          num_cols = xl_sheet.ncols  # Number of columns
          idx = 1
  
          acad = win32com.client.Dispatch("AutoCAD.Application")
  
          doc = acad.ActiveDocument  # Document object
          print(dir(doc))
          doc.Export('exportFile','bmp')
          print("MODEL SPACE")
          count=0
  ```
  </code></pre>
  
  <p>please help me to solve this?. the error I am getting is given below</p>
  
  <pre><code>**e_to_string_', '_username_', '_wrap_dispatch_']
  Traceback (most recent call last):
    File "auto1.py", line 63, in &lt;module&gt;
      doc.Export(exportFile,"bmp")
    File "&lt;COMObject &lt;unknown&gt;&gt;", line 3, in Export
  pywintypes.com_error: (-2147352562, 'Invalid number of parameters.', None, None)**
  </code></pre>
  
  <h2>   --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</h2>