Free Support Forum - aspose.com

Generate Images from DXF file failed: Image export failed. Parameter is not valid

Hello,
I need to generate images from a DXF. I use the following code to generate the images:

The Layouts is a string array: “L1A3”, “L2A3”

var menoryStreams = new List<MemoryStream>();
            customPlanStream.Position = 0;
            using (var cadImage = (CadImage) Aspose.CAD.Image.Load(customPlanStream))
            {
                foreach (var layout in layouts)
                {
                    var rasterOptions = new CadRasterizationOptions
                    {
                        PageWidth = 2600F * 3, //cadImage.Width
                        PageHeight = 2100F * 3, //cadImage.Height
                        AutomaticLayoutsScaling = true,
                        ExportAllLayoutContent = true,
                        DrawType = CadDrawTypeMode.UseObjectColor,
                        Margins = new Margins() { Top = 0, Bottom = 0 },
                        Quality = new RasterizationQuality
                        {
                            Arc = RasterizationQualityValue.High,
                            Hatch = RasterizationQualityValue.High,
                            Text = RasterizationQualityValue.High,
                            TextThicknessNormalization = true
                        }, 
                        Layouts = new string[] { layout }
                    };
                    var imageOptions = new JpegOptions
                    {
                        VectorRasterizationOptions = rasterOptions,
                        ColorType = JpegCompressionColorMode.Grayscale,
                    };

                    var output = new MemoryStream();
                    cadImage.Save(output, imageOptions);
                    output.Position = 0;
                    menoryStreams.Add(output);
                }
                customPlanStream.Position = 0;

                return menoryStreams;
            }

And give me the following error:
Image export failed. Parameter is not valid
error.png (63.6 KB)

The plan is:
plan.zip (1.6 MB)

Thanks for your help!

@RLCBertoni

I have verified the issue shared by you and a ticket with ID CADNET-8052 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

Hello,
@mudassir.fayyaz
Do you have news?

@RLCBertoni

The issue has been resolved in upcoming Aspose.CAD for .NET 21.4. The release has not been made public at the moment. We will share the news with you once the release will be shared online.