Replace Fonts in PDF to PDFA Conversion in C# using Aspose.PDF for .NET

We are pleased to announce a new version of Aspose.PDF for .NET, Aspose.PDF for .NET 11.8.0 . This month’s release is mainly a maintenance release with a couple of enhancements. It includes the replacement of fonts in PDF to PDFA conversion as the main enhancement. This release includes fixes of bugs reported by our valued customers in previous releases, that makes it more stable and better release as compared to previous versions. Some of these bug fixes related to PDF to PDFA, PDF to XPS, PDF to HTML, HTML to PDF, rendering XFA form to Static form, PDF to image. Please check release notes of Aspose.PDF for .NET 11.8.0 for the complete list.

Replacing Missing Fonts in PDF to PDFA Conversion

In PDF to PDFA conversion, sometimes fonts are neither embedded in the source PDF document and nor available on the machine, so it is required to replace missing fonts with some alternative fonts. We can substitute missing fonts as following.

Aspose.Pdf.Text.Font originalFont = null;
originalFont = FontRepository.FindFont("AgencyFB");
catch (Exception)
//Font is missing on destination machine
FontRepository.Substitutions.Add(new SimpleFontSubstitution("AgencyFB", "Arial"));
var fiNew = new FileInfo("newfile.pdf");
var pdf = new Document("myfile.pdf");
pdf.Convert("convertlog.xml", PdfFormat.PDF_A_1B, ConvertErrorAction.Delete);

Aspose.PDF for .NET Resources

The following resources will help you work with Aspose.PDF for .NET: