Skip to content
ComPDF

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);
}