M
M
MichaelN2013-08-21 15:22:10
Python
MichaelN, 2013-08-21 15:22:10

Pisa - xhtml2pdf div element sizes height, width not working

Hello, maybe someone has come across this.

I describe the style

<style>
        @page {
            margin: 0.5cm;   
        }
  div#main_header{
            background-color: yellow;
            border: 1px solid black;
            width: 100px;
        }
    </style>


<body>I write in the body
<div id="main_header">Обычный текст</div>

For me, when converting to pdf, the block <div>takes the width of the sheet, and not 100px.
Maybe someone will show you how to do it right, or where you can see an example.
Or there are even better alternatives to this library for Python.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Tyslyatsky, 2013-08-21
@MichaelN

Initially, I used xhtml2pdf, but it didn't render complex documents well (or it's just that my hands don't grow correctly), I switched to wkhtmltopdf , so far so good (the only minus needs to be set separately).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question