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

'The font does not contain a character: ’.' #474

Closed
mhfarrell opened this issue Aug 1, 2022 · 2 comments
Closed

'The font does not contain a character: ’.' #474

mhfarrell opened this issue Aug 1, 2022 · 2 comments

Comments

@mhfarrell
Copy link

PdfPig 0.1.6 Nuget Package.

I am following the guide within the github repo but i keep getting an error about the font not containing a character. I have attached a few lines of code. This particular string is throwing the error even though it does not contain the full stop character.

PdfDocumentBuilder.AddedFont font = document.AddStandard14Font(Standard14Font.Helvetica);

var test = "This is a Standard Item Called Understanding of customer’s query";
page.AddText(test, 12, closeToTop, font);

System.InvalidOperationException HResult=0x80131509 Message=The font does not contain a character: ’. Source=UglyToad.PdfPig StackTrace: at UglyToad.PdfPig.Writer.PdfPageBuilder.DrawLetters(NameToken name, String text, IWritingFont font, TransformationMatrix fontMatrix, Decimal fontSize, TransformationMatrix textMatrix) at UglyToad.PdfPig.Writer.PdfPageBuilder.AddText(String text, Decimal fontSize, PdfPoint position, AddedFont font) etc (cant share more as it reveals clients)

@mhfarrell
Copy link
Author

i see the character it doesnt like is ( ' ) rather than the full stop but this is still an issue. i just misread the error message.

@EliotJones
Copy link
Member

So it looks like you're passing the Microsoft curly apostrophe instead of the "normal" ASCII apostrophe '. The standard 14 fonts only support a limited character set. You might need to use a TrueType font if you want access to the Word symbols like curly quotes and apostrophes.
https://stackoverflow.com/questions/2826191/converting-ms-word-curly-quotes-and-apostrophes

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

2 participants