N
N
Nodir Malikov2021-03-06 12:54:15
Java
Nodir Malikov, 2021-03-06 12:54:15

ITextPDF Java. Why are Cyrillic fonts not displayed?

The document is created, but it is empty.

I found this on the Internet:
BaseFont bf = BaseFont.createFont("C:\Windows\Fonts\Arial.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
document.add(new Paragraph("Hello", new Font(bf, 10)));

But the error comes out:
Cannot resolve constructor 'Paragraph(java.lang.String, com.itextpdf.text.Font)'

How to correctly pass the Font to the paragraph?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan, 2021-03-06
Hasanly @azerphoenix

Cannot resolve constructor 'Paragraph(java.lang.String, com.itextpdf.text.Font)'

Obviously, there is no such constructor. See what constructors exist in the source code.
For example, here is the documentation
https://kb.itextpdf.com/home/it5kb/examples/using-fonts
https://www.tutorialspoint.com/itext/itext_setting...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question