Set background color

When converting CAD drawings with GroupDocs.Viewer there is no background color set by default but we proved an option that enables you to set any background color.

Setting background color when converting CAD Drawings

Let’s check how does output looks when converting sample CAD drawing with GroupDocs.Viewer.

And as you can see the background color of the output image below is white.

Now, lets set background color and convert CAD drawing one more time.

To set background color you need to specify the BackgroundColor property value in the CadOptions class.

The following code snippet shows how to set background color.

using (Viewer viewer = new Viewer("input.dwg"))
    PngViewOptions options = new PngViewOptions(pageFilePathFormat);
    options.CadOptions.BackgroundColor = System.Drawing.Color.Blue;

And here is output image with blue background color: