tfipsrd
February 12, 2025, 3:53pm
1
Hello,
In this pdf, the text (ex antiVibration Design) is in blue (like a turquoise).
image.png (13.9 KB)
But when we get the text fragment in Aspose.Pdf.net, the returned color is not the good one :
image.png (10.3 KB)
Aspose.pdf returning color #A61A33 which is like a dark red…
Here is the pdf :
testextractlight.pdf (39.1 KB)
Why the colors are not the good one here ?
We need a fix for this
Thanks
@tfipsrd
Have you tried the latest version (25.2) of the API? Can you please share complete sample code snippet for our reference as well? We will test the scenario in our environment and address it accordingly.
tfipsrd
February 13, 2025, 8:11am
3
@asad.ali : yes I did test with latest version
And here is the code snippet (its in your samples…)
public class SearchAndGetTextPage
{
public static void Run()
{
// ExStart:SearchAndGetTextPage
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdf_Text();
// Open document
Document pdfDocument = new Document(dataDir + "testextractlight.pdf");
// Create TextAbsorber object to find all instances of the input search phrase
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("Système antitache");
// Accept the absorber for all the pages
pdfDocument.Pages.Accept(textFragmentAbsorber);
// Get the extracted text fragments
TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;
// Loop through the fragments
foreach (TextFragment textFragment in textFragmentCollection)
{
foreach (TextSegment textSegment in textFragment.Segments)
{
Console.WriteLine("Text : {0} ", textSegment.Text);
Console.WriteLine("Position : {0} ", textSegment.Position);
Console.WriteLine("XIndent : {0} ", textSegment.Position.XIndent);
Console.WriteLine("YIndent : {0} ", textSegment.Position.YIndent);
Console.WriteLine("Font - Name : {0}", textSegment.TextState.Font.FontName);
Console.WriteLine("Font - IsAccessible : {0} ", textSegment.TextState.Font.IsAccessible);
Console.WriteLine("Font - IsEmbedded : {0} ", textSegment.TextState.Font.IsEmbedded);
Console.WriteLine("Font - IsSubset : {0} ", textSegment.TextState.Font.IsSubset);
Console.WriteLine("Font Size : {0} ", textSegment.TextState.FontSize);
Console.WriteLine("Foreground Color : {0} ", textSegment.TextState.ForegroundColor);
}
}
// ExEnd:SearchAndGetTextPage
}
}
The Background color should be something like #279EB6 (took with a screenshot and a pipette) and not the red #A61A33
@tfipsrd
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies .
Issue ID(s): PDFNET-59292
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.