itextPdf显示:网格不起作用

时间:2018-08-28 11:32:03

标签: java css scala itext

当我使用ItextPdf HTML到PDF转换器时,我尝试将HTML转换为PDF。但是当它转换时,我没有得到预期的结果,并且网格不起作用

expected result

例如,我有此代码

    val x =
  """
    |<html>
    |<head>
    |<style>
    |.grid-container {
    |  display: grid;
    |  grid-gap: 50px;
    |  grid-template-columns: auto auto auto;
    |  background-color: #2196F3;
    |  padding: 10px;
    |}
    |.grid-item {
    |  background-color: rgba(255, 255, 255, 0.8);
    |  border: 1px solid rgba(0, 0, 0, 0.8);
    |  padding: 20px;
    |  font-size: 30px;
    |  text-align: center;
    |}
    |</style>
    |</head>
    |<body>
    |
    |<h1>The grid-gap Property:</h1>
    |
    |<div class="grid-container">
    |  <div class="grid-item">1</div>
    |  <div class="grid-item">2</div>
    |  <div class="grid-item">3</div>
    |  <div class="grid-item">4</div>
    |  <div class="grid-item">5</div>
    |  <div class="grid-item">6</div>
    |  <div class="grid-item">7</div>
    |  <div class="grid-item">8</div>
    |  <div class="grid-item">9</div>
    |</div>
    |
    |<p>Use the <em>grid-gap</em> property to adjust the space between the columns <em>and</em> the rows.</p>
    |
    |
    |</body>
    |</html>
  """.stripMargin

HtmlConverter.convertToPdf(new ByteArrayInputStream(x.getBytes), doc, properties)

0 个答案:

没有答案