---
title: "Background"
canonical_url: "https://www.compdf.com/guides/generation-sdk/dotnet-core/generation/layout-api-background"
md_url: "https://www.compdf.com/guides/generation-sdk/dotnet-core/generation/layout-api-background.md"
description: "ComPDF SDK Guides. In this developer's guide, all the details and how to use ComPDF for SDK Guides will be covered in depth."
---

# Background

## Set Background Color

```csharp
div.SetBackgroundColor(new CColor(240, 240, 240, 255));
```

## Set Background Image

```csharp
// Set background image
using (CBackgroundImage bgImage = new CBackgroundImage())
{
    // Set single image source
    bgImage.SetSource("path/to/background.png");
    
    // Or set multiple image sources
    bgImage.SetSources(new string[] {
        "path/to/image1.png",
        "path/to/image2.jpg"
    });
    
    // Apply background image
    div.SetBackgroundImage(bgImage);
}
```
