How to set background color when converting CAD Drawings
Introduction
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 for Java.
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 setBackgroundColor(…) property value in the CadOptions class.
The following code snippet shows how to set background color.
try (Viewer viewer = new Viewer("input.dwg")) {
PngViewOptions options = new PngViewOptions(pageFilePathFormat);
options.getCadOptions().setBackgroundColor(Color.BLUE);
viewer.view(options);
}
And here is output image with blue background color:
More resources
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples:
- GroupDocs.Viewer for Java examples, plugins, and showcase
- Document Viewer for .NET App WebForms UI Modern Example
- Document Viewer for Java App Dropwizard UI Modern Example
- Document Viewer for Java Spring UI Example
- GroupDocs.Viewer for .NET samples, plugins and showcase
- Document Viewer for .NET MVC UI Example
Free Online App
Along with full-featured Java library we provide simple but powerful free Apps. You are welcome to view Word, PDF, Excel, PowerPoint documents with free to use online GroupDocs Viewer App.