在Django中将HTML转换为PDF后CSS无法正常工作

问题描述

我正在尝试使用xhtml2pdf库将HTML文件转换为PDF,以便在Django中进行下载。但是在转换为PDF后,CSS无法正常工作。 这是我的HTML代码段:

<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Certificate</title>
    {% load static %}
    <link href="{% static 'koss/css/bootstrap.min.css' %}" rel="stylesheet">
<style>

.test {
    position: relative;
    bottom: -309px;
    left: 331px;
    color: #151313;
    padding-left: 25px;
    padding-right: 20px;
}

#profile_image1{
    margin-top: -147px;
    margin-left: 171px;
}

#profile_image2{
    margin-left: 156px;
}

</style>
</head>
<body>
     <div class="test">
<h3>name 1</h3>
    </div>

     <div class="test">
<h3> name2  </h3>
    </div>

     <div class="test">
<h3>name3  </h3>
    </div>

  <img id="profile_image1" alt="image" class="img-fluid  m-3" src="{% static  'koss/img/memcirti1.png'%}"
                            onerror="imgError(this);">
     <br>

      <img id="profile_image2" alt="image" class="img-fluid  m-3" src="{% static  'koss/img/memcirti2.jpg'%}"
                            onerror="imgError(this);">

</body>
</html>

我该如何解决问题?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...