Hi,
PDF Alignment is damaged when we try to replace fonts in a PDF using C#.
The pdf file has fonts like below.
we want to replace all these fonts with courier new font.
Below is the code snippet we are using. but its not working
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(@"D:/TestPDF.pdf");
var lent = loadedDocument.UsedFonts.Length;
for (int j = 0; j < lent; j++)
{
loadedDocument.UsedFonts[j].Replace(new PdfStandardFont(PdfFontFamily.Courier, 10));
PdfFont newfont = new PdfTrueTypeFont(new Font("Courier", 14), true);
}
loadedDocument.Save("D:/Replacedfile.pdf");
loadedDocument.Close(true);
we are getting below error.
{"Can't replace font, the font is already embedded"}
Please help.