背景图像未显示在转换后的 html 到 pdf 中



我在使用您的转换 API 获取背景图像时遇到问题。 例如模板文件样式:

<meta charset="utf-8" />
<link href="https://use.typekit.net/mmg2zqw.css" rel="stylesheet" />
<style>
body, p, li, td, th, dt, dd { font-family: arboria, sans-serif, arial, helvetica; font-weight: 300; font-style: normal; font-size:20px; color:#333; }
body { background: url(/templates/backgrounds/certificate-background.png) no-repeat; }
img { border:none; display:block; }
p { margin-top:0; font-size: 20px;}
span { margin-top:0; font-size: 24px; color: #78BE21;}
h1, h2, h3, h4, h5 { font-family: arboria, sans-serif, arial, helvetica; font-weight: 300; font-style: normal; color:#555; }
h1 { font-size:68px; margin-top:10px; margin-bottom: 20px; }
h2 { font-size:52px; margin-top:5px; margin-bottom: 10px; color: #78BE21; }
h3 { font-size:30px; margin-top:5px; margin-bottom: 5px; }
h4 { font-size:18px; margin-top:5px; margin-bottom: 0; }
h5 { font-size:14px; margin-top:5px; margin-bottom: 0; }

是否需要向 api 调用添加参数以允许图像工作?

您正在考虑放置最小高度以查看可能的变化?因为如果您的标签不包含任何内容,那么您的背景将不可见。

试试这个在你的身体 :

body { 
background-image: url('/templates/backgrounds/certificate-background.png') no-repeat;
width: 100%
min-heigth: 500px;
}

最新更新