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

Free Support Forum - aspose.com

My JPG file converted from DXF is blank

Hello,

I’m presently working on a program that can be permit us to verify if our product is conform about the drawing. In fact, i need to convert my Dxf file to JPEG or PNG file. However when i launch my c# program, it works but the the JPEG file is blank. Can you help me to understand what’is my problem and how can i resolve it please ?

This is my code :
public String Convert_to_png(string numero)
{
string element_t = “”;

        // Load a CAD drawing in an instance of Image
        using (var image = Aspose.CAD.Image.Load(numero))
        {
            // Create an instance of CadRasterizationOptions
            var rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
            // Set image width & height
            rasterizationOptions.PageWidth = 1600;
            rasterizationOptions.PageHeight = 1600;
            rasterizationOptions.AutomaticLayoutsScaling = true;
            rasterizationOptions.NoScaling = false;
            rasterizationOptions.DrawType = Aspose.CAD.FileFormats.Cad.CadDrawTypeMode.UseDrawColor;
            rasterizationOptions.DrawColor = Aspose.CAD.Color.Black;

            // Set the drawing to render at the center of image
            rasterizationOptions.AutomaticLayoutsScaling = true;

            // Create an instance of JpegOptions (or any ImageOptions for raster formats)
            var options = new Aspose.CAD.ImageOptions.JpegOptions();
            // Set VectorRasterizationOptions property to the instance of CadRasterizationOptions
            options.VectorRasterizationOptions = rasterizationOptions;
            //Export each layer to Jpeg format
            String name = numero + ".jpg";
            image.Save(name, options);
            element_t = "ok";
        }

        return element_t;
    }<a class="attachment" href="/uploads/discourse_instance3/54163">317602cor_01_flat.zip</a> (2.9 KB)

@zanrefabrice

Can you please share the source file and product version used on your end. Please also share the generated PDF for reference.

317602cor_01_flat.dxf.jpg (59.0 KB)
317602cor_01_flat.zip (2.9 KB)

I use visual studio in c# for my code

@zanrefabrice

Can you please share the actual output that API should render. I can observe the blank PDF on my end.