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.
The font is getting changed but the alignment is getting damaged in side the pdf.
Please help.
var lent = loadedDocument.UsedFonts.Length;
for (int j = 0; j < lent; j++)
{
//Replace font
if (loadedDocument.UsedFonts[j].Type.ToString() != "TrueTypeEmbedded")
{
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)
Please help.