Hello,
I’m trying to convert a DXF to PDF with AsposeCad for .NET, ver 21.4.0.
I get this exception when converting : System.NullReferenceException: ‘Object reference not set to an instance of an object.’ on the using
statement of the following code
using (CadImage image = (CadImage)Image.Load(sourceFilePath))
{
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.UnitType = UnitType.Millimeter;
//A3
rasterizationOptions.PageWidth = 420;
rasterizationOptions.PageHeight = 297;
rasterizationOptions.Layouts = new string[] {"Layout1" };
rasterizationOptions.DrawType = CadDrawTypeMode.UseObjectColor;
PdfOptions pdfOptions = new PdfOptions();
pdfOptions.VectorRasterizationOptions = rasterizationOptions;
string fileName = Path.GetFileName(sourceFilePath);
string outputDir = Path.GetDirectoryName(sourceFilePath);
string outputFileName = fileName.Replace(".dxf", ".pdf");
string savePDFfilePath = outputDir + @"\" + outputFileName;
image.Save(savePDFfilePath, pdfOptions);
}