itext - 根本不支持 itext7.pdfhtml 中的 css 属性
问题描述
我正在使用itext7.pdfHtml
附加组件将我的 html 模板转换为 PDF 文档,一切正常,结果生成没有任何错误,但我的是有一堆 CSS 属性无法用 pdfhtml dll 识别。其中一些属性显示在此片段中:
.day-meta-wrapper {
font-size: 15px;
line-height: normal;
height: 24px;
border-radius: 12px;
color: #ffffff;
background: #00000033;----> not support
padding: 0 6px;
display: flex;----> not support
align-items: center;----> not support
justify-content: center;----> not support
}
这是我的 html 文件结果:
正如您在浏览器视图中看到的那样,没有问题,所有属性都正常工作,但这是我的 PDF 结果:
如图所示 PDF doc 松散了 CSS 属性
h1 {
background-color: red;
}
.day-meta {
margin: 5px 0;
user-select: none;
display: flex;
align-items: center;
justify-content: center;
}
.day-meta-wrapper {
font-size: 15px;
line-height: normal;
height: 24px;
border-radius: 12px;
color: #ffffff;
background-color: #00000033;
padding: 0 6px;
display: flex;
align-items: center;
justify-content: center;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="css/DayMeta.css">
</head>
<body style="background: #979797;">
<h1>Hello IText7 PDFHtml</h1>
<div class="day-meta">
<div class="day-meta-wrapper">
<div>December 11, 2018</div>
</div>
</div>
</body>
</html>
解决方案
推荐阅读
- c# - 不允许在谷歌电子表格中重复
- c - 什么是 __attribute__((unused)) 静态的?
- angular - Angular 6 路由器 - 替换当前路由的一些参数
- c# - Unity中的“对象引用未设置为对象的实例”错误
- javascript - 来自 Google Maps Javascript API 的简单示例返回 map not found 错误
- javascript - jQuery升级后JS函数坏了
- sql - 根据多个选择值更新表中的列
- python - 从Python中的列表中删除包含重复字段的非重复字典
- python - Python,意外行为:在对象实例中附加列表属性
- regex - 使用“awk”从日志文件中提取特定的 XML 模式