We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to set the page background color ?

Hi All,

Must likely be a stupid simple question but I can not find it
I am adding pages to pdf with the typical : page = mypdfdocument.Pages.Add();

But how to set the color of the page background ?
(note: I do not want a trick like inserting one object of the full page width & height, as it creates other problems if page is later changed or other)

thanks,
Fabrice

4 Replies

CM Chinnu Muniyappan Syncfusion Team April 25, 2016 11:39 AM UTC

Hi Fabrice, 

Thank you for contacting Syncfusion support. 

PDF page doesn’t have the support to set the background colors directly, we have to achieve this using draw and fill a rectangle object, we have created a simple sample for your reference, please refer the below sample. 

(note: I do not want a trick like inserting one object of the full page width & height, as it creates other problems if page is later changed or other) 
Please provide a details of the issues you are facing when trying the above solution to set the background color, so that we will provide you a solution. 
 

Please let us know if you have any concern. 

Regards, 
Chinnu 
 



FF fff April 26, 2016 11:17 AM UTC

Hi Chinnu,

thanks for your fast answer.

Yes of course this method is possible, but I was hopping to avoid one more layer in the page
I thought that because acrobat reader permits to change the background color in its interface, that was just a parameter, not one more object.
But if you say the PDF sta,ndard does not have that parameter for page, then ... no choice ... leave it like that

FYI, my reasons:
I have noticed that if the page has many layers/objects (...) per page, there is some visual glitch when reading the pdf in acrobat reader
The page is constructed by adding the elements while scrolling, and with the above method, the page is first displayed white, and very soon after the color changes ; this process is fast but noticeable to the eyes & not very pleasant (not SF fault here, just the method of acrobat & likely the speed of the computer)
This is the same with the other objects in the page, but here much more visible as it changes the whole color in the page, so a big surface

But OK, leave it like that ; nothing more to do here
Thanks again,
Fabrice



CM Chinnu Muniyappan Syncfusion Team April 27, 2016 12:01 PM UTC

Hi Fabrice, 

Thank you for your update. 

As mentioned earlier this is the default behavior of the Adobe reader; this is not an issue from our side,  

Please let us know if you need any further assistance. 

Regards, 
Chinnu 



CM Chinnu Muniyappan Syncfusion Team April 27, 2016 12:01 PM UTC

Hi Fabrice, 

Thank you for your update. 

As mentioned earlier this is the default behavior of the Adobe reader; this is not an issue from our side,  

Please let us know if you need any further assistance. 

Regards, 
Chinnu 


Loader.
Live Chat Icon For mobile
Up arrow icon