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

Free Support Forum - groupdocs.com

Conversion of DWG to PNG cuts off file

When I go to convert a .DWG CAD file to a .PNG image part of the image on the right side gets cut off during conversion. I’ve tried changing the height/width of the image and it still cuts off the image, but makes it smaller. Below is my code I am using and attached is a folder with the .DWG file and a screenshot of the result:

string infile = _configuratiuon["FilePath"] + drawing + ".dwg";
            string dataDir = AppDomain.CurrentDomain.GetData("DataDirectory").ToString();
            string outfile = Path.Combine(dataDir, drawing + ".png");

            using (Converter converter = new(infile))
            {
                SavePageStream getPageStream = page => new FileStream(string.Format(outfile, page), FileMode.Create);

                // Set the convert options for PNG format
                var options = new ImageConvertOptions { 
                    Format = ImageFileType.Png,
                    Height = 1000,
                    Width = 1400

                };
                // Convert to PNG format
                converter.Convert(getPageStream, options);
            }

ProblemFiles.7z (23.5 KB)

1 Like

@mattczajka

This issue is reproduced at our end. We have logged it in our internal issue tracking system with ID CONVERSIONNET-5045. It’ll be now further investigated. You’ll be notified about the outcomes.