We would like to change main font in PFD but the way described in documentation does not work for some reason.
Here is our code snippet:
- Code: Select all
//we have excel workbook in the stream and we need to save it as PDF
workbook.SaveToStream(writeStream, FileFormat.PDF);
PdfDocument pdf = new PdfDocument();
pdf.LoadFromStream(writeStream);
PdfUsedFont[] fonts = pdf.UsedFonts;
PdfFont newfont = new PdfFont(PdfFontFamily.TimesRoman, 11f, PdfFontStyle.Italic | PdfFontStyle.Bold);
foreach (PdfUsedFont font in fonts)
{
font.Replace(newfont);
}
The issue we have is that fonts array is empty and there is no setters for fonts except replacement.
Could you please clarify how we can set fonts?
Thanks