[英]How to configure hyphenation by iText7?
I try to hyphenate a String with the iText7 hyphenation .我尝试用iText7 hyphenation 连字符 String 。
I used the example Code, but it returns null and not a hyphenated String or Hyphenation Object:我使用了示例代码,但它返回 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"
My depenedncies from the pom.xml are:我对 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>
Is there any I forgot to configure?有没有我忘记配置的?
Thank you for helping me to solve this.:)谢谢你帮我解决这个问题。:)
You have hyph
as a test
dependency (see <scope>
).您将
hyph
作为test
依赖项(请参阅<scope>
)。 Which means, it is only added when you are running tests.这意味着,它仅在您运行测试时添加。 If you want to use
hyph
in non-test environment, make sure the dependency is eg compile
(default is compile
):如果您想在非测试环境中使用
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.