Free Support Forum - aspose.com

Setting custom background color

I want to set custom background color for pdf pages. I want to convert a hash color value in the form of string to ASPOSE color. For example: #252525 to some ASPOSE color. Is it possible?

@swapAsposeLearning,

Thanks for contacting support.

In case you need to set the page background color for PDF document, please try using following code snippet with Aspose.Pdf for .NET.

[C#]

// load PDF document
Aspose.Pdf.Document doc = new Document("c:/pdftest/Input (2).pdf");
// specify background color information for first page of document
doc.Pages[1].Background = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.FromArgb(252525));
// save resultant PDF
doc.Save("c:/pdftest/Input (2)_BackGround.pdf");