Tse JunZhen
Tse JunZhen

Reputation: 11

JAVA Openhtmltopdf(flyingsource) library why text-align justify is not working?

Below content generate by Tidy library, and pdf show me no justtify, is openhtmltopdf library not support ? or my content giving by Tidy is wrong ? Please help my week...

<!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>

Upvotes: 1

Views: 484

Answers (1)

Neuber dCastro
Neuber dCastro

Reputation: 11

Isn't it because you didn't include the line breaks? In this case, no matter how broken the source is, it interprets, when rendering, that it is as if it were the same line. You have to use the tags for breaking:

<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>

Upvotes: 1

Related Questions