Closed ctaque closed 2 months ago
encode_utf16_be
can only be used for text that isn't rendered as content of a page (notes, table.of content entries).
Rendering regular text is more complicated and requires selecting the correct glyphs from the font.
I don't know how to do it myself so I sadly can't help you.
Okay I understand. I will close this since I found a solution using PyPDF2 and pyo3 bindings to python.
https://stackoverflow.com/questions/78983568/question-about-special-characters-and-font-rendering-in-pdf?noredirect=1#comment139263849_78983568
I'm adding text to a pdf using the Tj operator with Courier Font and encoding the text in hexadecimal a such documented :
The document rendering is correct in brave-browser, special chars like é, è or ° are corrects.
However, The text added in the pdf in Firefox or Evince or Okular is displayed with rectangles.
I tried ghostscript to embed the fonts in a post process.
pdffonts before ghostscript:
pdffonts after ghostscript:
Output of the ghostscript command when run in the console:
Now it looks almost correct in Firefox, Evince or Okular.
However special characters are missing or incorrect.
Please provide a working exemple with special characters such as é, è or °.