all
I created a pdf template using libreoffice. I tried to fill chinese string into these field but only garbage in those fields. code like below:
PdfFont kaiuFont = PdfFontFactory.createFont("c:/windows/fonts/kaiu.ttf", true);
FileOutputStream output = new FileOutputStream("d:/download/202106.pdf");
PdfDocument pdf = new PdfDocument(new PdfReader(template), new PdfWriter(output));
PdfAcroForm form = PdfAcroForm.getAcroForm(pdf, true);
Map<String, PdfFormField> fields = form.getFormFields();
fields.get("COMPANY_TITLE").setValue(<Chinese words>).setFontAndSize(kaiuFont, 18f);
pdf.close();
What's wrong with those code?