Aspose Pdf - Font changing when assigning textFragment.Text

version aspose.total 23.4.0
When textFragment.Text receive some value with specifics caracteres the font style is changing for something indesired.
textFragment.Text = “testk”;
For example if my value contains “k” it will change font style to ORIUPP+TimesNewRoman from what was used in the pdf
image.png (50,7 Ko)

@oriaspose

Would you please try using 23.9 version of the API? In case issue still persists, please share your sample PDF document along with generated output. Also, please share the sample code snippet for our reference. We will test the scenario in our environment and address it accordingly.

Good morning,
i changed to the last version but the error persists.
aspose upgrade.PNG (16,2 Ko)
debug error.PNG (78,0 Ko)

the final result is a different font style
result.PNG (4,2 Ko)

it crashs the application in a server where the different font does not exists
fonterror.PNG (31,6 Ko)

PDF:GabaritTest.pdf (214,4 Ko)
Code sample:

 public async Task Test(Stream fileStream)
    {
        Stream streamcopie = new MemoryStream();
        await fileStream.CopyToAsync(streamcopie);
        streamcopie.Seek(0, SeekOrigin.Begin);
        Document document = new(streamcopie);

        //find text in the pdf document we want to change
        TextFragmentAbsorber textFragmentAbsorber = new("TextToChange", new TextSearchOptions(false));
        document.Pages.Accept(textFragmentAbsorber);
        var textsFragmentsAbsorbers = textFragmentAbsorber.TextFragments;

        foreach (var textFragment in textsFragmentsAbsorbers)
        {
            var oldFontStyle = textFragment.TextState.FontStyle;
            var font = textFragment.TextState.Font.BaseFont;
            textFragment.Text = "testk";//word with "k" will trigger the error
            textFragment.TextState.FontStyle = oldFontStyle;
            var test = textFragment.TextState.Font;
        }
        
        MemoryStream memoryStream = new();
        document.Save(memoryStream, SaveFormat.Pdf);
        memoryStream.Seek(0, SeekOrigin.Begin);
    }

Thank you

@oriaspose

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

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.