PDF Text color issue

Any updates on this ticket please?

@IqviaPal

We are afraid that the ticket could not get fully investigated yet due to other issues in the queue. Nevertheless, your concerns have already been recorded and we will surely inform you as soon as we have some definite updates about ticket resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.

Can you please let me know, are there any updates on this, as it is a priority item in our product development.

@IqviaPal

We are afraid that the issue is not yet resolved due to other pending issues in the queue. Please note that it was logged under free support model and it will be resolved on a firsts come first serve basis. Your concerns have been recorded however and we will surely let you know once we have some updates in this regard. Please be patient and spare us some time.

We are sorry for the inconvenience.

Can you please let me know, any progress on this issue?

@IqviaPal

Sadly, no updates are available at the moment about ticket resolution. We will let you know in case we have some news about issue fix. We apologize for your inconvenience.

Can you please let me know, is there any progress on this issue?

@IqviaPal

We are afraid to share that no updates are available at the moment about ticket resolution. We will inform you as soon as we have some news in this regard. We are sorry for the inconvenience.

At least can you please tell me how long it will take to consider this item? Since we are depending on Aspose PDF library for many functionalities in our software, and it is critical for us.

@IqviaPal

We are trying to come up with some ETA and will share with you as soon as possible. Please spare us little time.

Please let me know the progress on the ETA you mentioned in your reply?

@IqviaPal

We have investigated the issue and found a source of the problem. The point is that in PDF vector graphics objects (including font glyphs) may have two colors. The first one is color for non-stroking operations. Also, it can be named a “fill color”. Usually, when talking about the “foreground color”, they mean the fill color e.g. “color for non-stroking operations” in the terms of PDF.

The second color is the color for stroking operations. Also, it can be named a “border color” or a “line color”. If the document creator sets the border color to a different color than the fill color, and additionally sets a large (>10% of the glyph height) borderline thickness, then the entire glyph will look like it is filled with the border color.

This is what is observed in the document for the characters “1” and “2”. We have the StrokingColor property in the TextState and it returns the correct - blue color.

However, given that users are rarely aware of the details of glyph rendering, we have decided to change the mechanics of the ForegroundColor property. Starting from Aspose.PDF 23.4 it will returns “observed color” for the cases like this.

The issues you have found earlier (filed as PDFNET-52001) have been fixed in Aspose.PDF for .NET 23.4.

Hi

      I have another document, wherein, when we try to process the text items like changing the text color, the Text gets corrupted, can you please look into this issue as well, if required I will provide the Test PDF.

@IqviaPal

Sure. please share your sample PDF with us along with the code snippet that you are using. We will test the scenario in our environment and address it accordingly.

Here I am sending the text file, one is before applying changes using Aspose
(Test document-Before Process.pdf), and anther is after applying text color change using Aspose Library
(Test document-After Process with Aspose.pdf),
And the code parts related to the above is as mentioned below.

 Aspose.Pdf.Text.TextFragmentAbsorber textFragmentAbsorbernew = new Aspose.Pdf.Text.TextFragmentAbsorber();
 Aspose.Pdf.Rectangle rect = annot.Rect;
textFragmentAbsorbernew.TextSearchOptions = new TextSearchOptions(rect);
string LinkTextColor....//Here we assinging the desired text color string;
 try
{
	foreach (Aspose.Pdf.Text.TextFragment TextFrag in textFragmentAbsorbernew.TextFragments)
	{
		System.Drawing.Color color1 = System.Drawing.ColorTranslator.FromHtml(LinkTextColor);
		TextFrag.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(color1);
		//TextFrag.TextState.ForegroundColor = Aspose.Pdf.Color.Black;
	}
	isDocSave = true;
}

the above code working fine for other PDFs, but for the attached file, it creating issue. please verify this issue.
Test document-After Process with Aspose.pdf.pdf (177.3 KB)
Test document-Before Process.pdf (178.1 KB)

@IqviaPal

We were unable to use this code snippet. It is incomplete. Can you please share the complete code snippet that we can use to replicate the issue in our environment?

Here is the code snippet used to change the Link text color, on applying the text color (e.g. to blue color), and saving the pdf, the text in the pdf gets corrupted. Please look into the issue and help me to fix the issue.
AnnotationCollection annots = pdfDoc.Pages[SourcePage].Annotations;
for (int index = 1; index <= annots.Count; index++)
{
Annotation annot = annots[index];
string Aname = annot.GetType().Name;

            if (Aname.Equals("LinkAnnotation"))
            {
                Aspose.Pdf.Page page = pdfDoc.Pages[SourcePage];
				Aspose.Pdf.Text.TextFragmentAbsorber textFragmentAbsorbernew = new Aspose.Pdf.Text.TextFragmentAbsorber();
				Aspose.Pdf.Rectangle rect = annot.Rect;
			   
				textFragmentAbsorbernew.TextSearchOptions = new TextSearchOptions(rect);
				textFragmentAbsorbernew.Visit(page);
				try
				{
					foreach (Aspose.Pdf.Text.TextFragment TextFrag in textFragmentAbsorbernew.TextFragments)
					{
					   TextFrag.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(0,0,256);
					   
					}
				   
				}
				catch (NullReferenceException ex)
				{

				}
                    
                
            }
        }

@IqviaPal

We are checking it and will get back to you shortly.

@IqviaPal

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-55347

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.