Free Support Forum -

Incorrectly interpreted foreground/text color?


I’m trying to extract text from pdf file with specific color.

Pdf file is prepared with Aspose.Words. Text color is set to RGB (0,0,254). When I’m reading it in Acrobat Professional, text blue part is still 254. But when I’m trying to check it with Aspsoe.Pdf I’m getting 253. But if I use RGB (0,0,255) on word doc in Aspose.Pdf everything looks Ok.
Tested with Aspose.Pdf 7.1 and 7.4.

public void Correct_Text_Color()
Aspose.Words.Document doc = new Aspose.Words.Document();
DocumentBuilder docBuilder = new DocumentBuilder(doc);
docBuilder.ParagraphFormat.Style.Font.Color = System.Drawing.Color.FromArgb(0, 0, 254);


doc.Save(“Bluetext.pdf”, SaveFormat.Pdf);

Aspose.Pdf.Document pdfDoc = new Aspose.Pdf.Document(“Bluetext.pdf”);

TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber();

foreach (TextFragment textFragment in textFragmentAbsorber.TextFragments)
Assert.AreEqual(254, textFragment.TextState.ForegroundColor.B, “Incorrect foreground color!”);
//Assert.AreEqual(“ff0000fe”, textFragment.TextState.ForegroundColor.Name, “Incorrect foreground color!”);

Jacek Bator

Hi Jacek,

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

Thank you for the sample code.

I am able to reproduce your mentioned issue after an initial test. Your issue has been registered in our issue tracking system with issue id: PDFNEWNET-34370. We will inform you via this forum thread regarding any updates. As you have reported this issue under normal support forum, please confirm if you need us to move this issue under Enterprise Support.

Sorry for the inconvenience,

The issues you have found earlier (filed as PDFNEWNET-34370) have been fixed in Aspose.Pdf for .NET 10.7.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.