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)