[英]How to configure hyphenation by iText7?
我嘗試用iText7 hyphenation 連字符 String 。
我使用了示例代碼,但它返回 null 而不是連字符字符串或連字符 Object:
Hyphenator h = new Hyphenator("de", "DE", 2, 2);
Hyphenation s = h.hyphenate("Leistungsscheinziffer");
System.out.println(s);//this is null and not "Lei-stungs-schein-zif-fer"
我對 pom.xml 的依賴是:
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>layout</artifactId>
<version>7.1.2</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>hyph</artifactId>
<version>7.1.2</version>
<scope>test</scope>
</dependency>
有沒有我忘記配置的?
謝謝你幫我解決這個問題。:)
您將hyph
作為test
依賴項(請參閱<scope>
)。 這意味着,它僅在您運行測試時添加。 如果您想在非測試環境中使用hyph
,請確保依賴項為compile
(默認為compile
):
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>hyph</artifactId>
<version>7.1.2</version>
</dependency>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.