We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Set color of pdf page

Hi Team,

I am generating a pdf and I want the second page of the pdf to have page red color and table of contents, I have the table of contents but need to set the page color to red.

So every pdf can have any number of pages but the second page will always be red in color along with table of contents.

using .net aspose

@jinivthakkar

I have worked over your requirements and like to request you to please try using the below sample code in your environment and then share your kind feedback with us.

   //Load the document
   Document document = new Document(dataDir);
   //Get reference to the 2nd page of PDF document
   Page page = document.Pages[2];
   //Set the background
   page.Background = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Red);
   //Save the document
   document.Save(dataDir);

I hope this will be helpful. Please let us know if you need any further assistance.

Thanks it worked like a charm !

@jinivthakkar

Thank you for sharing your feedback.

We are glad to know things are working on your end as per your requirements. Please keep using our API and in event of any further query, feel free to ask.