0

I am trying to convert an HTML file to PDF for download purpose in Django using xhtml2pdf library. But after converting to PDF, the CSS is not working. Here is my HTML code snippet:

<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>

How can I solve the problem?

3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.