Aspose.PDF for .NET/ Replace font at a time

Hi Aspose Team,

We are using Aspose.Pdf to convert PDF to other formats. And we noticed that some text cannot be displayed normally because the font cannot be found.

So we want to replace these fonts. We saw in the Docs that Aspose can traverse through all the TextFragments and replace fonts one by one, but this will take a lot of time.

Is there a way to replace a specific font at a time?

Thanks.

@Glority_Developer

You can please try setting the default font name of the PDF document which will be used in case some other referred font is absent in the system;

// Load an existing PDF document with missing font
string documentName = dataDir + "input.pdf";
string newName = "Arial";
using (System.IO.FileStream fs = new System.IO.FileStream(documentName, System.IO.FileMode.Open))
using (Document document = new Document(fs))
{
    PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
    // Specify Default Font Name
    pdfSaveOptions.DefaultFontName = newName;
    document.Save(dataDir + "output_out.pdf", pdfSaveOptions);
}

In case you still face any issue, please share your sample PDF document with us. We will test the scenario in our environment and address it accordingly.