Слияние кода завершено, страница обновится автоматически
замены显得 очень擁挤
Версия: 3.2.1
JDK: 1.8
Операционная система: macOS 15
PdfHandler.getFontHandler().addFont(PdfBoxTest.class.getResourceAsStream("org/dromara/xjxt/pdf/font/simfang.ttf"), "simhei", FontType.TTF);
PdfHandler.getFontHandler().getFontNames().forEach(System.out::println);
Document document = PdfHandler.getDocumentHandler().load("/Users/Documents/личные данные/текстовый документ 2宋体.pdf");
ReplaceProcessor processor = PdfHandler.getDocumentProcessor(document).getReplaceProcessor();
Map<String, String> params = new HashMap<>();
params.put("${xword}", "замененный текст");
PDFont font = PdfHandler.getFontHandler().getPDFont(document.getTarget(), "FangSong");
processor.replaceText(font, params, 0);
document.save("//Users/Documents/личные данные/текстовый документ 2宋体-replace.pdf");
MergeProcessor mergeProcessor = PdfHandler.getDocumentProcessor(document).getMergeProcessor();
document.close();
Результат замены: