PdfSharpCore
PdfSharpCore copied to clipboard
Couldn't able to add custom font family and font weight
I'm trying to add custom font family and font weight in the inline html. But I couldn't able to see any changes in the generated pdf.
var htmlContent = <div> <div style='font-family: fantasy; font-weight: 600;'>36</div> </div>;
PdfDocument pdfDoc = new PdfDocument(); PdfGenerator.AddPdfPages(pdfDoc, htmlContent, PageSize.A4); using (MemoryStream ms = new MemoryStream()) { pdfDoc.Save(ms); response = ms.ToArray(); string fileName = "D:\downloads\pdf\" + DateTime.Now.Ticks + ".pdf"; File.WriteAllBytes(fileName, response); }
In the above code. I'm trying to convert html to pdf and save in my local machine. But the resulted pdf doesn't applied font-family and font-weight. Can anyone help me to sort out the issue? Is there any documentation or example for how to use custom font family (ex: Fantasy)?