danomatic / react-pdf-html

Render HTML in react-pdf
MIT License
172 stars 40 forks source link

Is there a support for displaying special characters? #104

Closed romeJG closed 2 months ago

romeJG commented 3 months ago

In my code it does not display the "₱" sign correctly it just shows "±" even for other special characters such as "Ω"(Omega), " α"(Alpha)

code is:

let html =`
  <html>
    <body>
      <div>
        ₱  Ω  α 
      </div>
    </body>
  </html>
`

output: ± ⓒ ±

Even when I use a HTML code like &#945; still it will render as ±

danomatic commented 3 months ago

I don't think this library modifies the text, so this may be more related to the character set used in your react-pdf document. LMK if you figure out the cause!

romeJG commented 3 months ago

thanks! I'll get back here if I figure it out.

romeJG commented 2 months ago

Registering the font that supports these kinds of special characters needs to be imported, so that react PDF will render it correctly.

ref: React PDF: Fonts