Мой вопрос очень прост: как я могу центрировать текст в PDF, используя PDFBox
?
Я не знаю строку заранее, я не могу найти середину при испытании. Строка не всегда имеет одинаковую ширину.
Мне нужно:
- Метод, который может центрировать текст, что-то вроде
addCenteredString(myString)
- Метод, который может дать мне ширину строки в пикселях. Затем я могу вычислить центр, поскольку я знаю размеры PDF.
Любая помощь приветствуется!