We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

.dwg files

hi,

I just want to know if there is a solution for DWG files,

Thank you


Hi Oussama,


Thank you for considering Aspose APIs, and welcome to Aspose.Imaging support forum.

Firstly, please note that we have moved your thread to the appropriate support forum because Aspose.Imaging is the only API that could load the DWG files for possible conversion to raster images or PDF format. Other manipulation of DWG drawings isn’t support at the moment.

If you wish to give the API a try on your end, we would request you to download & try the latest version of Aspose.Imaging for .NET 2.6.0. The code snippets to convert the DWG drawings to raster images & PDF format are provided below.

Converting DWG to Raster Images

using (Image image = Image.Load(myDir + “sample.dwg”))
{
//Create an instance of CadRasterizationOptions
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
//Set page width & height
rasterizationOptions.PageWidth = 1200;
rasterizationOptions.PageHeight = 1200;

//Create an instance of PngOptions for the resultant image
ImageOptionsBase options = new PngOptions();
//Set rasterization options
options.VectorRasterizationOptions = rasterizationOptions;
//Save resultant image
image.Save(myDir + “output.png”, options);
}

Converting DWG to PDF Format

using (Image image = Image.Load(myDir + “sample.dwg”))
{
//Create rasterization options
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.PageWidth = 1200;
rasterizationOptions.PageHeight = 1200;

//Create Pdf options
PdfOptions pdfOptions = new PdfOptions();
pdfOptions.VectorRasterizationOptions = rasterizationOptions;

//Exporting Cad to Pdf
image.Save(myDir + “output.pdf”, pdfOptions);
}

Note: At the moment, the API supports for reading AutoCAD 2004 DWG (version 16.0 Release 18) format only.