0

I am trying to set PDFields (in pdAcroForm) file with data containing Unicode Latin Extended-A character.

Getting below error:

java.lang.IllegalArgumentException: U+0154 is not available in this font's encoding: WinAnsiEncoding

We use linux and mac machines to generate pdf.

Sample Code:

        try(PDDocument document = PDDocument.load(this.getClass().getClassLoader().getResourceAsStream("template/xyz.pdf"))){

        PDDocumentCatalog pdCatalog = document.getDocumentCatalog();
        PDAcroForm pdAcroForm = pdCatalog.getAcroForm();
       
        if(pdAcroForm.getField(DATA) != null && StringUtils.isNotEmpty(DATA))
            pdAcroForm.getField(DATA).setValue("Ŕaym");
        
            
  • 1
    https://stackoverflow.com/questions/42903217/write-cyrillic-chars-into-pdf-form-fields-with-pdfbox/ does it help you? – zolty13 Aug 18 '20 at 07:52
  • Welcome on stackoverflow. Plase not be offended and read https://stackoverflow.com/help/how-to-ask to be more clear with your questions – zolty13 Aug 18 '20 at 07:54
  • @zolty13 Question is OK, and your link is too. – Tilman Hausherr Aug 18 '20 at 09:06
  • You need to change the font for that field, or you won't be able to use "special" characters. Either ask the author of the PDF to use another font, or use the link from zolty13. (Note my comment at the end of the answer, i.e. take care not to subset the font) – Tilman Hausherr Aug 18 '20 at 09:10

0 Answers0