spipu / html2pdf

OFFICIAL PROJECT | HTML to PDF converter written in PHP
http://html2pdf.fr/en/default
Open Software License 3.0
1.68k stars 751 forks source link

HTML2PDF margin bug [HELP NEEDED ACTUALLY] #689

Open kromoss opened 3 years ago

kromoss commented 3 years ago

I am currently using html2pdf to convert a document in my company to PHP, to be able to include my variables afterwards and save it as a pdf, the problem is currently with my "div M1,M2,M3". I make it align with "#M1,#M2,#M3{display: inline;}" however I feel that my M2 "TEL:" is based on the top frame, rather than on the M1

code :

<img src="logoTCSfinal.png" class="tcs" style="width:10%;margin left:20px;margin-right: 550px;"> <img src="ICSL.png" class="ics" style="width:10%;"><br>

<div style="width: 100%;padding-left:2px;padding-top:2px;font-weight: 600;padding- bottom:2px;border: 3px solid #000000; text-align: left;">DEFINITION DES BESOINS</div>

<style>#M1,#M2,#M3{display: inline;}</style> <div id="M1" style="padding-left:5px;padding-top: 10px;font-weight: 600;">SOCIETE: </div> <div id="M2" style="clear: both;font-weight: 600;">TEL:</div> <div id="M3" style="font-weight: 600;">FAX:</div>'; $html2pdf = new Html2Pdf(); $html2pdf->writeHTML($html); $html2pdf->output(); ?>

but however it displays it to me like this :

Capture

the "TEL:" is too far to the right

kromoss commented 2 years ago

à aucun moment tu t'est dit tient je vais centrer ma div ? at no time did you say to yourself "I'm going to center my div?

NEEED HELP

arsaey commented 2 years ago

bro try to work with position:relative and left: xmm... its better.