Not able to add fonts using embedded resource

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Not able to add fonts using embedded resource



While converting Html to Pdf templates, I am adding fonts to FontProvider.
I am trying to load my font files as embedded resources.


FontProvider


Assembly assembly = typeof(TestClass).Assembly;
string fPath= assembly.GetName().Name + "." + "Fonts.";
List<string> fD= assembly.GetManifestResourceNames().Where(name => name.StartsWith(fPath)).ToList();



But while creating FonrProgram using above fontDirectories, I am getting exception.(Exception : Document has no pages. It is not able to load the font file.)


FonrProgram


fontDirectories


foreach (string font in fD)

FontProgram fp = FontProgramFactory.CreateFont(font);
fontProvider.AddFont(fp, PdfEncodings.IDENTITY_H);



Can someone please help me on this?



Note: I am able to load the font file by giving below directory path.


string font = @"SEGOEUI.TTF";
FontProvider fp = new DefaultFontProvider(false, false, false);
FontProgram defaultFont = FontProgramFactory.CreateFont(font);
fp.AddFont(defaultFont);









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

make 2 or more post in bootsrap

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3

Firebase Auth - with Email and Password - Check user already registered