缺少html

编程入门 行业动态 更新时间:2024-10-10 09:23:24

缺少<a href=https://www.elefans.com/category/jswz/34/1771262.html style=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

本文发布于:2024-05-07 21:08:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1757265.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:html

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!