html"/>
缺少html
我正在使用HTML-pdf库将HTML页面转换为pdf。我在pdf上获得了动态部分,但是据说图像丢失了。我曾尝试使用所有方法,但该图像未出现在生成的pdf中。我该怎么办?以下是我的HTML模板:
<head>
<title>Certificate</title>
<!-- <link rel="stylesheet" href="../stuff/certificate.css"> -->
<style>
html,
body {
height: 100%;
width: 100%;
}
img{
height: 100%;
width: 100%;
margin:0px;
}
#name{
margin-top:-420px;
margin-left: 60px;
}
p{
font-size:40px;
color:black;
font-weight:400;
text-align: center;
}
</style>
</head>
<body>
<img src="../stuff/certificate.jpg">
<div id="name"><p><%=name%></p></div>
</body>
</html>
我按照我的意愿取了名字,但是图像根本没有出现。请帮助。与html相比,图片位于不同的文件夹中。
回答如下:尝试使用JS library that detect when images have been loaded.
您可以这样使用它:
<script src="https://npmcdn/[email protected]/imagesloaded.pkgd.min.js"></script>
<script type="text/javascript">
imagesLoaded(document.body, function() {
window.print();
});
</script>
更多推荐
缺少html
发布评论