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

Free Support Forum - aspose.com

Background color lost from output to PDF

Hi! I am converting .RTF files to both MS Word .doc and .PDF files. I notice that a page background color is preserved when converted as .doc, but as .PDF the background color is removed. I'm basically using code like:

Document doc = new Document(inPath);
(... create a DataRow, fill with some data...)
doc.MailMerge.Execute(dr);

doc.Save("Test.doc", SaveFormat.Pdf, SaveType.OpenInWord, Response);


Is there a way to convert such that page background color is carried over? Any help would be appreciated, thanks!

Hi Chris,

Thanks for your inquiry.

Could you please attach your rtf template files here for testing? I will take a closer look and give you some feedback.

Thanks,

I've attached a sample rtf file that converts to .Doc with the yellow background intact, but not to .Pdf. Thanks for your help!

-Chris

Hi Chris,

Thanks for attaching your documents.

I cannot reproduce the issue using the latest verison of Aspose.Words for .NET (Version 9.3). You can download it from here.

If you have any further queries, please feel free to ask.

Thanks,

Hi,

I tested with the latest DLL, but there was no difference. After doing more troubleshooting, I've been able to narrow it down to just Page Color; other highlights and colors come through fine. See the attached in/out files.

Any ideas what I might be doing wrong? Is there another RTF property other than Page Color I could use to set the background color in my template?

-Chris

Hi Chris,

Thanks for this additional information. I'm afraid I'm still unable to reproduce the issue on my side. I have attached the rendered document to my post. Are you able to create a small test project that will reproduce the issue so I can test it on my side?

Thanks,

Hi Chris,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. As I can see you are still use old version of Aspose.Words (6.0.1) to convert document to PDF. Please try using the latest version as Adam already suggested.

Best regards.

My appologies, a script from another project was replacing my newer dll with the old one. I see the color correctly now, thanks for the help.

Incidentally, would you happen to know the earliest version of Aspose.Words this support existed in?

-Chris

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. This problem was resolved in 8.0.0 version of Aspose.Words.

Best regards,