[英]Gembox.Document: Convert HTML to Pdf, border css does not work
I am using to Gembox.Document to convert HTML to PDF.我正在使用Gembox.Document将 HTML 转换为 PDF。 This is my HTML:
这是我的 HTML:
<div style="border-top:5px solid black;border-left:5px solid black;padding:2px 15px;font-size:18px;font-weight:bold;line-height:22px; background-color:aquamarine;width:230px">
Test
</div>
But in PDF, the border is lost.但是在 PDF 中,边框丢失了。
Do you know how to fix this problem?你知道如何解决这个问题吗?
Edit: I add sample code: (test HTML link: https://www.gemboxsoftware.com/document/examples/c-sharp-convert-html-to-pdf/307 )编辑:我添加示例代码:(测试 HTML 链接: https : //www.gemboxsoftware.com/document/examples/c-sharp-convert-html-to-pdf/307 )
<!DOCTYPE html>
<html>
<body>
<table style="width:100%;" cellpadding="0" cellspacing="0">
<tr>
<td style="width:50%;">
<div style="border-top:5px solid black;border-left:5px solid black;padding:2px 15px;font-size:18px;font-weight:bold;line-height:22px; background-color:aquamarine;width:230px">
Test
</div>
</td>
<td style="width:50%;font-size:18px;font-weight:bold;line-height:22px;">Number</td>
</tr>
</table>
<div style="border-top:5px solid black;border-left:5px solid black;padding:2px 15px;font-size:18px;font-weight:bold;line-height:22px; background-color:aquamarine;width:230px">
Test
</div>
</body>
</html>
Edit 2: I found out a solution to fix, it is really not beautiful but at least it worked for me编辑 2:我找到了一个解决方案来修复,它确实不漂亮,但至少对我有用
<table style="width:100%;" cellpadding="0" cellspacing="0">
<tr>
<td style="width:50%;">
<table style="width:150px;margin:0px" cellpadding="0" cellspacing="0">
<tr>
<td style="border-top:1px solid black;border-left:1px solid black;">
<div style="padding:2px 15px;font-size:18px;font-weight:bold;line-height:22px;">
Test
</div>
</td>
</tr>
</table>
</td>
<td style="width:50%;font-size:18px;font-weight:bold;line-height:22px;">Number</td>
</tr>
</table>
What version are you using?你用的是什么版本? Perhaps you should try again with the current latest bugfix version,from here .
也许您应该从这里使用当前最新的错误修复版本再试一次。
I tried converting this HTML:我尝试转换此 HTML:
And I get this PDF:我得到了这个 PDF:
As you may notice, the top and left borders are there.您可能会注意到,顶部和左侧边框都在那里。 Also, all other CSS except "width" are there.
此外,除“宽度”之外的所有其他 CSS 都在那里。
Last, I also tried "display" and "visibility" and it seems that both work.最后,我还尝试了“显示”和“可见性”,似乎两者都有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.