Page.BackgroundColor
Contents
[
Hide
]Page.BackgroundColor property
Gets or sets page’s background color.
public Color BackgroundColor { get; set; }
Examples
Shows how to set page’s background color.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Pages();
// Load OneNote document and get first child
Document document = new Document(Path.Combine(dataDir, "Aspose.one"));
foreach (var page in document)
{
page.BackgroundColor = Color.BlueViolet;
}
document.Save(Path.Combine(dataDir, "SetPageBackgroundColor.one"));
Shows how to apply Dark theme style to a Document.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Text();
// Load the document into Aspose.Note.
Document doc = new Document(Path.Combine(dataDir, "Aspose.one"));
foreach (var page in doc)
{
page.BackgroundColor = Color.Black;
}
foreach (var node in doc.GetChildNodes<RichText>())
{
var c = node.ParagraphStyle.FontColor;
if (c.IsEmpty || Math.Abs(c.R - Color.Black.R) + Math.Abs(c.G - Color.Black.G) + Math.Abs(c.B - Color.Black.B) <= 30)
{
node.ParagraphStyle.FontColor = Color.White;
}
}
doc.Save(Path.Combine(dataDir, "AsposeDarkTheme.pdf"));
See Also
- class Page
- namespace Aspose.Note
- assembly Aspose.Note