S
S
SwoDs2015-11-17 17:25:27
PHP
SwoDs, 2015-11-17 17:25:27

Russian text is not displayed in the PDF preview. What to do?

Good evening.
I use iText + PHP to fill out PDF forms.
There are several questionnaires that need to be filled out, questionnaires in which the fields are filled in with pens, everything is fine, but the questionnaires where the fields generated by Adobe are not visible in the Russian font in the preview, if you add the field by hand, removing all settings (checking text errors, scrollbar) is then visible.
from English. all OK.
preview - joxi.ru/DrlNxRJuMxJq2P
when clicked - joxi.ru/eAOl8GgFyD7Mro
How to make it always displayed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MIK Ek, 2015-11-18
@SwoDs

iText needs to add
BaseFont times = BaseFont.createFont("times.ttf","cp1251",BaseFont.EMBEDDED);
Paragraph p=new Paragraph("two there",new Font(times,14));
Or if you combine xfdf with pdf using iText. It's like this:
//args[0]="source pdf"
//args[1]="result pdf"
//args[0]="xfdf file name"
PdfReader pdfreader = new PdfReader(args[1]);
PdfStamper stamp = new PdfStamper(pdfreader, new FileOutputStream(args[0]));
XfdfReader fdfreader = new XfdfReader(args[2]);
AcroFields form = stamp.getAcroFields();
BaseFont times = BaseFont.createFont("times.ttf","cp1251",BaseFont.EMBEDDED);
form. addSubstitutionFont(times);
form.setFields(fdfreader);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question