【问题标题】:JAVA Openhtmltopdf(flyingsource) library why text-align justify is not working?JAVA Openhtmltopdf(flyingsource) 库为什么 text-align justify 不起作用?
【发布时间】:2020-09-24 07:51:59
【问题描述】:

以下内容由 Tidy 库生成,并且 pdf 不显示 justtify,是否不支持 openhtmltopdf 库?还是我 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>

【问题讨论】:

    标签: java css pdf-generation tidy openhtmltopdf


    【解决方案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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-07-03
      • 2021-12-25
      • 1970-01-01
      • 2016-02-07
      • 1970-01-01
      • 1970-01-01
      • 2020-11-04
      相关资源
      最近更新 更多