You can use following steps to convert from DWG files to PNG Image files and trim the margins from PNG image files also.
1. Use DWG to Vector Converter Command Line to convert your DWG file to PDF file first,
https://www.verydoc.com/dwg-to-vector.html
https://www.verydoc.com/verydoc_dwg2vector_cmd.zip
You could run following command line to convert your DWG file to PDF file,
dwg2vec.exe C:\test.dwg C:\out.pdf
2. Use PDF to Image Converter Command Line to convert the PDF file to PNG file with 600 DPI option,
http://www.verypdf.com/app/pdf-to-image-converter/command-line.html
http://www.verypdf.com/dl2.php/pdf2image_win.zip
You could run following command line to convert your PDF file to PNG image file with 600DPI,
pdf2img.exe -r 600 D:\test.pdf D:\out.png
3. Use "trimimage.exe" in docPrint Pro to trim the margins from PNG image file,
http://www.verypdf.com/app/document-converter/try-and-buy.html#buy_pro
http://www.verypdf.com/artprint/docprint_pro_setup.exe
after you download and install it, you could run following command line to trim the margins from your PNG image file,
"C:\Program Files (x86)\docPrint Pro v8.0\psdriver\trimimage.exe" D:\dwg2png.png D:\dwg2png_trim.png
The final D:\dwg2png_trim.png file will no margins, we hope above steps will useful to you.