CADViewer Technical Documentation, Installation Guide and Reference Samples Library

How do I change the Background Color?


Use the -b or -background parameter. The value is an integer (0 to 255) that defines the AutoCAD Light Palette Color Index, so 0 is black, 1 is red, 7 is white, etc. For the simple colors (0 to 7) and some of the others, you can also names, blank, red, white, lightgrey, etc.

For SVG this will set the CSS background-color value. For PDF it will create a rectangle filling the full page with that color. It will be behind all the other entities on the page. For raster formats the background pixels will be set to that color.

Since the rest of the drawing will be unaffected, use colors other that white and black with caution. If the background is white then white objects (those using AutoCAD Color index 7, but not those with an explicit RGB color value of 255,255,255) will be output as black. Similarly, if the background is black, then black objects will be output as white. Nothing will happen for other background colors, so you may have red on red, or green on green, etc. Your mileage may vary.


Use the Background Color menu button or API call.

Last updated on 2 Mar 2022
Published on 12 Apr 2020