I’m using GemBox.Pdf to create a new PDF document, using Visual Studio 2022/.Net 6. I’m trying to load the Google “Poppins-Regular” font as follows:
var _PoppinsFont = new PdfFontFamily(null, "Fonts", "Poppins-Regular.ttf");
I’ve tried setting the “Build Action” property to “Resource”, and “Embedded resource”, but I am not able to get this font to load. I don’t see any error message, but my document appears to fall back to a default Serif font. Is there something about this particular font that would be causing the issue?
Mario,
I reviewed the Custom Fonts example again and tried to add in the Google Poppins font.
If I compile the example as .Net 4.8 using Visual Studio 2019, the Almonte Woodgrain font works, but the others do not.
If I compile the example as .Net 5.0 or .Net 6.0 using Visual Studio 2022, none of the fonts appear to work.
Note: all of these examples used GemBox.Pdf 17.0.1363. I tried to zip these examples so I could send them to you, but this page won’t let me upload a zip file. How should I send these to you?
FYI, the actual program that I am writing is a .Net 6.0 console app.
When I run locally, this works fine. But when the program is run from the server it does not load the font.
I have my fonts in a top-level “Fonts” folder and they are all set to .
I load the fonts with this statement: _PoppinsFont = new PdfFontFamily(“Fonts”, “Poppins”);
The “Fonts” folder exists on the server, but it clearly does not find/load the font. Any ideas?
Also, is there some way that the code can determine at run time whether the “new PdfFontFamily(“Fonts”, “Poppins”);” statement worked successfully or not?
I found that I can use a system font instead of trying to use a private font. Now the problem I have is, the generated PDF document seems to randomly drop individual characters. Any idea why this might be happening? We need to generate these letters in production next week.
I created a test project to reproduce the issue, then zipped all the files. However, the Contact page will not let me send the Zip file to you. I can Choose the file and that appears to work (I see a small icon and “47.4 MB”). But when I click on Submit, I get a message that says: “Uploaded file was not found. Please try again.” I tried several times, all with the same result.
First can you please check that you’re not zipping the “bin” and “obj” folders?
Second, can you please try again by sending that zip to our email that’s mentioned on the Contact page?
Hey guys, facing exactly the same issue here, the font is missing some characters for no reason (not always the same !)
“ThisIsLEsWEbFOntflongF” renders as
Facing the issue at least with Zcool & Special Elite from google font.
How did you endup solving this ?
Thanks
Damien,
I was advised to make sure that I call “page.Content.BeginEdit()” before my code updates the page, and then call “page.Content.EndEdit()” once my code is done updating the page. This fixed the issue for me.