Setting background color to PdfPageStamp

I’d like to set the background color for a PdfPageStamp to white. Using Aspose.PDF .NET 11.6.0.


Here’s what I’ve tried:
var fragmentDoc = new Document(path) {Background = Color.White};
fragmentDoc.Flatten();
fragmentDoc.Optimize();

Page fragmentPage = fragmentDoc.Pages[1];
fragmentPage.Background = Color.White;
            
fragmentDoc.ProcessParagraphs();

var stamp = new PdfPageStamp(fragmentPage)
{
    Width = BlockWidth,
    Height = BlockHeight,
    Background = false,
    PdfPage = {Background = Color.White}
};
            
return stamp;

Setting the color on the doc or the page doesn’t take effect. Even if I call process paragraphs.

Hi Dirk,


Thanks for contacting support.

Can you please share complete code snippet and resource files which you are using, so that we can test the scenario in our environment. We are sorry for this inconvenience.

PS, I have tried replicating the issue using one of my sample PDF files, but I am unable to replicate it.