1

I am working on a project where I use itextPdf for digitally signing pdf documents. The signing works just fine except the fact that diacritics (ț, ă and ș) are not displayed in the pdf signature appearance layer text. For instance if I sign a document with an certificate who's holder name is Păun John, the result signature displayed on the page would contain something like "Digitally signed by Pun John...". I tried setting the font via setLayer2Font with multiple fonts and none seems to work x|. An excerpt from the code is shown below.

    PdfSignatureAppearance sap = stp.getSignatureAppearance();
        sap.setReason(reason);
        Font fnt;
        BaseFont bf = BaseFont.createFont("c:/windows/fonts/arial.ttf", BaseFont.CP1252, BaseFont.EMBEDDED);
        fnt = new Font(bf,12);
        sap.setLayer2Font(fnt);

Edit: This will do the job:

   BaseFont bf = BaseFont.createFont("c:/arial.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
inniko
  • 21
  • 1
  • 3
  • 1
    You use Arial encoded using `BaseFont.CP1252`. Code page 1252 most likely does not contain those characters. – mkl Feb 28 '14 at 12:58
  • That was only one example, I've also tried Times_Roman with utf8 and many other combinations. what Is You'r suggestion I should try? Maybe it'll work. – inniko Feb 28 '14 at 14:51
  • Utf8 won't help, this is pdf after all. IDENTITY_H might do. – mkl Feb 28 '14 at 16:56
  • Instead of editing the solution into your question, you had better made it an answer and eventually accepted it. – mkl Sep 02 '14 at 09:22

0 Answers0