Free Support Forum -

Set Background Color of Pages in Word Document C# .NET | Show background colors and images in Print Layout view

The document is transferred to the system, when it is wanted to be viewed in .PDF format, it is seen that its background is in GRAY color. We are using Aspose.Word.21.6 version.
Test project is attached.
YG14973 - AsposeTestProject (904.3 KB)


The problem occurs because your Word DOCX document actually has a Gray background color which becomes invisible when you view it in Print Layout View of MS Word. In Microsoft Word you can turn On/Off this option by following the path below:

File | Options | Advanced | Show Document Content | Show background colors and images in Print Layout view.

You can manually remove background color by using following option in MS Word:

Design | Page Color | More Colors | Set 255 in RGB boxes

Or use the following code of Aspose.Words for .NET API to fix this problem:

Document doc = new Document("C:\\Temp\\YG14973 - AsposeTestProject -Word\\YG14973.docx");
doc.PageColor = Color.Empty;
doc.Save("C:\\Temp\\YG14973 - AsposeTestProject -Word\\21.6.pdf");

Also, please refer to: Word Document’s Page Color Property