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

Unicode character Issue #70

Closed
abhi0476 opened this issue Feb 16, 2017 · 8 comments
Closed

Unicode character Issue #70

abhi0476 opened this issue Feb 16, 2017 · 8 comments

Comments

@abhi0476
Copy link

If html contains some character like → ,it shows # instead.
Can you please suggest a fix

@danfickle
Copy link
Owner

Hi @abhi0476

You need to provide a font that can render the character in question. This font file is specified via a font-face rule. It can be the primary font for the given text or one of the fallback fonts.

@danfickle
Copy link
Owner

Example at font-face example

@abhi0476
Copy link
Author

@danfickle
Thanks for the reply. Fixed it using the method: builder.useFont
However it takes some time to load the font.

@taras19921
Copy link

taras19921 commented Sep 18, 2018

Hi all,

I have a problem with unicode characters. In PDF file I see "#" instead of "ă" or "ș" .
How I can fix it? Thank you.

@taras19921
Copy link

taras19921 commented Sep 19, 2018

I have ocrb10 font in my html template. @font-face { font-family: ocrb10; src: url('${host}/ocrb10.ttf') } I've tried to add 'unicode-range: U+?????;' to this font-face but it doesn't work. I still see "#" instead of "ă" or "ș" I can not find ocrb10 font in Unicode.

@danfickle
Copy link
Owner

Hi,

unicode-range is not supported. Things to check:

  • The embedded font is true type and contains the missing characters.
  • The element where the missing characters are used actually is using the embedded font in its font-family property.

For other tips, see the fonts wiki page:
https://github.com/danfickle/openhtmltopdf/wiki/Fonts

@MichaelZaleskovsky
Copy link

Hi! I have same problem now with openhtmltopdf.
I want to get PDF from html, which contains cyrillic. I use this library in servlet.
But I have same result - the cyrillic simbols converted to #

I use pdfBulider in this way:
pdfBuilder
.useFastMode()
.withHtmlContent(html, "/")
.toStream(stream)
.run();
and html string contains:

<style> @font-face { font-family: "PT Sans"; src: url("https://fonts.googleapis.com/css?family=PT+Sans&subset=cyrillic "); } body { font-family: 'PT Sans', Geneva, Arial, Helvetica, sans-serif; } </style>

But it doesn't help me.
Could you help me - what is the problem?

@alexvrv
Copy link

alexvrv commented Feb 3, 2022

Any tips for this problem? I have the same problem, can't get rid of #....

com.openhtmltopdf.exception WARNING:: Bad URL given: /ocrb10.ttf => java.net.URISyntaxException:: missing protocol for URI: /ocrb10.ttf

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

5 participants