有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

css JAVA Openhtmltopdf(flyingsource)库为什么textalign justify不起作用?

下面是Tidy library生成的内容,pdf show me no Justify,openhtmltopdf library不支持吗?或者Tidy提供的内容是错误的?请帮助我的一周

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta name="generator"
content="HTML Tidy for Java (vers. 2009-12-01), see jtidy.sourceforge.net" /><style
 type="text/css">
/*<![CDATA[*/
p {
  text-align: justify;
  text-justify: inter-word;
}
/*]]>*/
</style>
    <title>
    </title>
  </head>
  <body>
    <p style="text-align: justify;">
      this is my text, this is my text, this is my text, this is my text, 
      this is my text, this is my text, this is my text, this is my text, 
      this is my text, this is my text, 
      this is my text, this is my text, this is my text, this is my text, 
      this is my text, this is my text, 
      this is my text, this is my text.
    </p>
  </body>
</html>

共 (1) 个答案

  1. # 1 楼答案

    是不是因为你没有包括换行符?在这种情况下,无论源有多破碎,渲染时都会将其解释为好像是同一条线。您必须使用标签来断开:

    <p style="text-align: justify;">
      this is my text, this is my text, this is my text, this is my text, <br/>
      this is my text, this is my text, this is my text, this is my text, <br/>
      this is my text, this is my text, <br/>
      this is my text, this is my text, this is my text, this is my text, <br/>
      this is my text, this is my text, <br/>
      this is my text, this is my text.
    </p>