Closed pixelogik closed 10 years ago
I solved the problem by using divs as pages, setting their sizes accordingly
<html>
<head>
<style type='text/css'>
.myPage{width:20cm; height:20cm;margin:0cm;padding:0cm;}
</style>
<head>
<body style='margin:0cm; padding:0cm;'>
<div class='myPage' style='background-color:#0000ff;'>
<div style='position:absolute; left:10cm;top:0cm;width:1cm;height:10cm;background-color:black;'>
</div>
</div>
<body>
</html>
Hi @pixelogik, I had the same need a while ago and I solved it in exactly the same way, I use DIVs that have the width and height equal to the page and then I relative positioning inside. I recall it was a bit tricky to find the right numbers for the body of the page and the borders...
Hi @cloudify ,
alright. Thanks for letting me know!
Hi again,
does anybody have experience when it comes to css metrics in the html?
I just try to center a div using cm as metric, but is wont work. I have a page size of 20x20cm as set by
and position the div with
but it is not in the middle. I tried already setting the page size for print media with
but it did not help.
After searching a lot it seems that this is a general problem of wkhtmltopdf. I am just wondering if anybody here knows a solution to this?
Thanks Ole