টপিকঃ PDF লাইব্রেরী ও পিএইচপি জটিলতা
MPDF লাইব্রেরী ব্যবহার করে এইচটিএমএল ও সিএসএস দিয়ে পিডিএফ বানানোর কাজ করছি। ইমেজ আর এইচটিএমএল ভালোভাবেই কাজ করছে সমস্যা দেখা দিয়েছে সিএসএস নিয়ে। ডাইভগুলো ফ্লোট হচ্ছেনা ঠিক মত। সাইজ ৮০০পিক্স থেকে ৭০০ পিএক্স করেছি , কিন্তু কোন কাজ হয়নাই। সিএসএস গুলো ইনফাইলে নিয়ে এসেছি, তাতেও কাজ হচ্ছে না। এখন কেবল ইনলাইন করা বাকী।
php কোডঃ
<?php
include("mpdf.php");
$html = '<!DOCTYPE html>
<html>
<head>
<title>Invoice</title>
<!--<link rel="stylesheet" href="css/invoice.css" />-->
<style type="text/css">
.container{ width: 700px; margin: auto;}
.addressLogo{ height: 320px;}
.address{ height: 300px;}
.invoice{height: 15px;
width: 100%;
margin: 20px 0px;
background: none repeat scroll 0% 0% rgb(34, 34, 34);
text-align: center;
color: white;
font: bold 15px Helvetica,Sans-Serif;
letter-spacing: 20px;
padding: 8px 0px;}
.address{ width: 450px; height: 300px; float: left;}
.logo{width: 250px; height: 300px; float: left;text-align: center; padding-top:5px;}
table { border-collapse: collapse; }
table td, table th { border: 1px solid black; padding: 5px; text-align: left;}
.customer{ padding-top: 40px; width:550px; height: 170px;}
.company{ width:550px; height: 130px; font-size: 25px;}
.cartItem { width: 700px;}
</style>
</head>
<body>
<div class="container">
<div class="invoice">INVOICE</div>
<div class="addressLogo">
<div class="address">
<div class="customer">
Saiful Islam<br>
Systech Ict<br>
Kazla, , Dhaka-1205 </div>
<div class="company">
Host-71 Ltd<br>
1,Lake circus, Kolabagan Busstand,<br>
Dhaka-1205
</div>
</div>
<div class="logo">
<img src="http://localhost/host71/logo.png" width="100px;" style="padding-top:30px;padding-bottom:30px;">
<table>
<tr>
<td width="80px">Invoice #</td>
<td width="165px">10</td>
</tr>
<tr>
<td>Date #</td>
<td>14-12-2013</td>
</tr>
</table>
</div>
</div> <!--addressLogo -->
<div class="cartItem">
<table>
<tr>
<td width="500px">Item Name</td>
<td width="100px">Time</td>
<td width="100px">Price ($)</td>
<td width="100px">Subtotal ($)</td>
</tr>
<tr>
<td>71 Mini (hosting)</td>
<td>12</td>
<td>1.04</td>
<td>13.04</td>
</tr>
<tr>
<td>Domain (domain)</td>
<td>48</td>
<td>1</td>
<td>49</td>
</tr>
<tr>
<td width="500px"></td>
<td width="100px"></td>
<td width="100px">Grand Total</td>
<td width="100px">62.04</td>
</tr>
<tr>
<td width="500px"></td>
<td width="100px"></td>
<td width="100px">Amount Paid</td>
<td width="100px">0</td>
</tr>
<tr>
<td width="500px"></td>
<td width="100px"></td>
<td width="100px">Balance Due</td>
<td width="100px">62.04</td>
</tr>
</table>
</div>
<div style="padding-top:50px;">
<hr>
<strong>Important:</strong> If you place an order and do not pay within 3 days, we will cancel the order.
<hr>
</div>
</div> <!--Container end-->
</body>
</html>
<head>
';
$mpdf=new mPDF();
$mpdf->SetDisplayMode('fullpage');
$mpdf->WriteHTML($html);
$mpdf->Output();
exit;
?>
সিএসএস আলাদা করে $mpdf->WriteHTML($css,1); প্যারামিটার ১ দিয়েও দেখেছি , কাজ হয় না।
এদিকে এটার পিএইচপি বাইন্ডিং পেলাম , কিন্তু সার্ভারে কনফিগ করতে পারছি না। আপনাদের সাহায্য আমার একান্ত কাম্য