在 PDF 生成期间不呈现有序和无序列表
Ordered and Unordered List is not rendered during the PDF Generation
我正在使用 iText-5.5.6 和 XMLWorker-5.5.6。我在 PDF 生成期间遇到了一个奇怪的问题,因为我无法从源 HTML 内容中看到有序或无序列表。我正在从编辑器控件中获取 HTML 内容。内容如下:
htmlContentEn = "<html><body style=\"font-family: Arial;\"><p>I personally thank you for your continued commitment and I look forward to continue our journey to make one of the best the world.</p><p>Bullets:</p><ol><li><div>One</div></li><li><div>Two</div></li><li><div>Three</div></li></ol></body></html>";
下面用于生成 PDF 的 Java 代码如下:
p = new XMLParser(worker);
p.parse(new ByteArrayInputStream(htmlContentEn.getBytes(Charset.forName("UTF-8"))), Charset.forName("UTF-8"));
try{
for (Element e : elements) {
contentEnCell.addElement(e);
}
}catch(IllegalArgumentException e){ }
我需要你的帮助。
提前致谢。
我试过这个:
<html>
<body style="font-family: Arial;">
<p>I personally thank you for your continued commitment and I look forward to continue
our journey to make one of the best the world.</p>
<p>Bullets:</p>
<ol>
<li>One</li>
<li>Two</li>
<li>Three</li>
</ol>
</body>
</html>
它工作正常。
我试过这个:
<html>
<body style="font-family: Arial;">
<p>I personally thank you for your continued commitment and I look forward to continue
our journey to make one of the best the world.</p>
<p>Bullets:</p>
<ol>
<li><div>One</div></li>
<li><div>Two</div></li>
<li><div>Three</div></li>
</ol>
</body>
</html>
它不能正常工作。
虽然将 <div>
直接嵌套到 <li>
中很尴尬,但我会在我们的问题跟踪器中报告这一点。
您可以通过删除不必要的 <div>
标签来解决此问题(这会立即解决您的问题),否则您将不得不等待 iText 的支持来解决此问题。如果您是客户,您将获得修补程序。如果您不是客户,则需要等待几个月(我们刚刚发布了 5.5.6)。请注意,使用 5.5.6 可能需要您是客户:观看视频 Is iText free? 了解更多信息。
我正在使用 iText-5.5.6 和 XMLWorker-5.5.6。我在 PDF 生成期间遇到了一个奇怪的问题,因为我无法从源 HTML 内容中看到有序或无序列表。我正在从编辑器控件中获取 HTML 内容。内容如下:
htmlContentEn = "<html><body style=\"font-family: Arial;\"><p>I personally thank you for your continued commitment and I look forward to continue our journey to make one of the best the world.</p><p>Bullets:</p><ol><li><div>One</div></li><li><div>Two</div></li><li><div>Three</div></li></ol></body></html>";
下面用于生成 PDF 的 Java 代码如下:
p = new XMLParser(worker);
p.parse(new ByteArrayInputStream(htmlContentEn.getBytes(Charset.forName("UTF-8"))), Charset.forName("UTF-8"));
try{
for (Element e : elements) {
contentEnCell.addElement(e);
}
}catch(IllegalArgumentException e){ }
我需要你的帮助。
提前致谢。
我试过这个:
<html>
<body style="font-family: Arial;">
<p>I personally thank you for your continued commitment and I look forward to continue
our journey to make one of the best the world.</p>
<p>Bullets:</p>
<ol>
<li>One</li>
<li>Two</li>
<li>Three</li>
</ol>
</body>
</html>
它工作正常。
我试过这个:
<html>
<body style="font-family: Arial;">
<p>I personally thank you for your continued commitment and I look forward to continue
our journey to make one of the best the world.</p>
<p>Bullets:</p>
<ol>
<li><div>One</div></li>
<li><div>Two</div></li>
<li><div>Three</div></li>
</ol>
</body>
</html>
它不能正常工作。
虽然将 <div>
直接嵌套到 <li>
中很尴尬,但我会在我们的问题跟踪器中报告这一点。
您可以通过删除不必要的 <div>
标签来解决此问题(这会立即解决您的问题),否则您将不得不等待 iText 的支持来解决此问题。如果您是客户,您将获得修补程序。如果您不是客户,则需要等待几个月(我们刚刚发布了 5.5.6)。请注意,使用 5.5.6 可能需要您是客户:观看视频 Is iText free? 了解更多信息。