How to change the default font of replaced text

Description

When I replace the text in the PDF, the font of part of the text is different from the original text block. It is set to the default font “Arial Unicode MS”. How can I modify this default font?

Env

  • Windows 11
  • Aspose.PDF for .NET 24.2

Code

void Test()
{
	var doc = new Aspose.Pdf.Document(@"C:\Users\Administrator\Desktop\test.pdf");
	TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("期货市场");
	doc.Pages.Accept(textFragmentAbsorber);
	TextFragmentCollection textFragments = textFragmentAbsorber.TextFragments;
	foreach (TextFragment textFragment in textFragments)
	{
		textFragment.Text = "测试数据";
	}
	doc.Save(@"C:\Users\Administrator\Desktop\o.pdf");
}

Note

I already know that the modified PDF font is not necessarily exactly the same as the original font, the reason being that there is subsetting of the fonts in the PDF file. However, I would like to be able to modify the default font that Aspose automatically sets.

Files

test.zip (681.6 KB)

@xucongli1989
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-56619

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.