Free Support Forum -

Convert DWG to PDF error


Im usgin this code for convert DWG file to PDF

string sourceFilePath = myDir + “office.dwg”;
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(sourceFilePath))
//Create an instance of CadRasterizationOptions and set its various properties
Aspose.Imaging.ImageOptions.CadRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.CadRasterizationOptions();
rasterizationOptions.BackgroundColor = Aspose.Imaging.Color.White;
rasterizationOptions.PageWidth = 1600;
rasterizationOptions.PageHeight = 1600;

//Create an instance of PdfOptions
Aspose.Imaging.ImageOptions.PdfOptions pdfOptions = new Aspose.Imaging.ImageOptions.PdfOptions();
//Set the VectorRasterizationOptions property
pdfOptions.VectorRasterizationOptions = rasterizationOptions;

//Export the DWG to PDF
image.Save(myDir + “result.pdf”, pdfOptions);


The save process send error mesage: Image saving failed.

That could generate this error?

Thank you


Hi Rodrigo,

Thank you for considering Aspose APIs.

Please provide us the DWG file that triggers the said exception so we could further investigate the matter to pin point the problem cause. Moreover, please provide us the complete stack trace along with the inner exception for further analysis.