Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couldn't able to add custom font family and font weight #410

Open
YukeshM opened this issue Nov 21, 2023 · 0 comments
Open

Couldn't able to add custom font family and font weight #410

YukeshM opened this issue Nov 21, 2023 · 0 comments

Comments

@YukeshM
Copy link

YukeshM commented Nov 21, 2023

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)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant