JezK
Edit File: sample_pdf.php
<?php ini_set('display_errors', '1'); // require_once("./vendor/autoload.php"); require_once __DIR__ . '/vendor/autoload.php'; $mpdf = new \Mpdf\Mpdf(['tempDir' => '/tmp']); $path = '/tmp/mpdf'; // You should change this as prefered. if (!file_exists($path)) { mkdir($path, 0777, true); } $mpdf = new \Mpdf\Mpdf(['tempDir' => $path,'debug' => true]); // $mpdf = new mPDF(); $template = ' <table width="100%" style="font-family: sans-serif;" cellpadding="10"> <tr> <td width="100%" style="padding: 0px; text-align: center;"> </td> </tr> <tr> <td width="100%" style="text-align: center; font-size: 20px; font-weight: bold; padding: 0px;"> INVOICE </td> </tr> <tr> <td height="10" style="font-size: 0px; line-height: 10px; height: 10px; padding: 0px;"> </td> </tr> </table> <table width="100%" style="font-family: sans-serif;" cellpadding="10"> <tr> <!-- <td width="49%" style="border: 0.1mm solid #eee;">Name<br>Company Name<br>Area<br>Area 2<br>Kent<br>0123 6NN</td> <td width="2%"> </td> --> <td width="49%" style="border: 0.1mm solid #eee; text-align: right;"> <strong><?php echo $companyInfo["company_name"]; ?></strong><br><?php echo $companyInfo["address"]; ?><br><?php echo $companyInfo["city_name"]; ?><br> </td> </tr> </table> <br> <div class="containercontent"> <div class="card-1 shadow-sm p-3 mb-5 p-md-0 bg-white rounded"> <div class="card-body invoices_page_div"> <div class="row align-items-center"> <div class="col-md-5 col-lg-2 col-sm-6"> <label for="invoices" class="custom-label"><?php echo $lang["INVOICES_NUMBER"];?></label> </div> <div class="col-md-5 col-lg-3 col-sm-6 d-flex align-itens-start custom-padding"> <span class="colon">:</span> <?php echo $invoiceNumber; ?> </div> <div class="col-md-5 col-lg-3 col-sm-6"> <label for="whnumber" class="custom-label"><?php echo $lang["WAREHOUSE_NUMBER"];?></label> </div> <div class="col-md-5 col-lg-2 col-sm-6 d-flex align-itens-start custom-padding"> <span class="colon">:</span> <?php echo $warehouseNumber; ?> </div> </div> <div class="row align-items-center"> <div class="col-md-5 col-lg-2 col-sm-6"> <label for="whname" class="custom-label"><?php echo $lang["WAREHOUSE_NAME"];?></label> </div> <div class="col-md-5 col-lg-3 col-sm-6 d-flex align-itens-start custom-padding"> <span class="colon">:</span> <?php echo $warehouseName; ?> </div> <div class="col-md-5 col-lg-3 col-sm-6"> <label for="invoices" class="custom-label"><?php echo $lang["QUOTATION_VALUE"];?></label> </div> <div class="col-md-5 col-lg-2 col-sm-6 d-flex align-itens-start custom-padding" > <span class="colon">:</span> <?php echo $invoiceValue; ?> <span id="currencyType"><?php echo $currencyType ?></span> </div> </div> <div class="row align-items-center" > <div class="col-md-5 col-lg-2 col-sm-6 col-6"> <label for="customer" class="custom-label"><?php echo $lang["CUSTOMER_NAME"];?></label> </div> <div class="col-md-5 col-lg-3 col-sm-6 d-flex align-itens-start custom-padding"> <span class="colon">:</span> <?php echo $customerName; ?> </div> <div class="col-md-5 col-lg-3 col-sm-6 col-6"> <label for="whnumber" class="custom-label"><?php echo $lang["DATE"];?></label></div> <div class="col-md-5 col-lg-2 col-sm-6 d-flex align-itens-start custom-padding"> <span class="colon">:</span> <?php echo $modifiedDate; ?> </div> </div> </div> </div> </div> <br> <table border="1" style="border-collapse:collapse"> <tr> <th style="font-family:Verdana, Geneva, sans-serif; font-weight:600; font-size:13px; border-top:1px solid #333; border-bottom:1px solid #333; border-left:1px solid #333; border-right:1px solid #333;" align="center"><?php echo $lang["INVOICE_NUMBER"];?></th> <th style="font-family:Verdana, Geneva, sans-serif; font-weight:600; font-size:13px; border-top:1px solid #333; border-bottom:1px solid #333; border-left:1px solid #333; border-right:1px solid #333;" align="center"><?php echo $lang["DESCRIPTION"];?></th> <th style="font-family:Verdana, Geneva, sans-serif; font-weight:600; font-size:13px; border-top:1px solid #333; border-bottom:1px solid #333; border-left:1px solid #333; border-right:1px solid #333;" align="center"><?php echo $lang["DESCRIPTION"];?></th> <th style="font-family:Verdana, Geneva, sans-serif; font-weight:600; font-size:13px; border-top:1px solid #333; border-bottom:1px solid #333; border-left:1px solid #333; border-right:1px solid #333;" align="center"><?php echo $lang["QUOTATION_ID"];?></th> <th style="font-family:Verdana, Geneva, sans-serif; font-weight:600; font-size:13px; border-top:1px solid #333; border-bottom:1px solid #333; border-left:1px solid #333; border-right:1px solid #333;" align="center"><?php echo $lang["NUMBER_OF_PALLETS"];?></th> <th style="font-family:Verdana, Geneva, sans-serif; font-weight:600; font-size:13px; border-top:1px solid #333; border-bottom:1px solid #333; border-left:1px solid #333; border-right:1px solid #333;" align="center"><?php echo $lang["QUANTITY"];?></th> <th style="font-family:Verdana, Geneva, sans-serif; font-weight:600; font-size:13px; border-top:1px solid #333; border-bottom:1px solid #333; border-left:1px solid #333; border-right:1px solid #333;" align="center"><?php echo $lang["PRICE"];?> (<?php echo $currencyType ?>)</th> <th style="font-family:Verdana, Geneva, sans-serif; font-weight:600; font-size:13px; border-top:1px solid #333; border-bottom:1px solid #333; border-left:1px solid #333; border-right:1px solid #333;" align="center"><?php echo $lang["TOTAL"];?></th> </tr> <tr> <?php echo $tableHTML; ?> </tr> </table> <div class="d-flex justify-content-between align-items-baseline borderdashed"> <div> <label><strong><?php echo $lang["Grand_Total_value"];?><strong></label> </div> <div class="inputwid"> <span class="inputWidth"> <?php echo $grandtotal ?> </span> </div> </div> </div>'; // $mpdf = new \Mpdf\Mpdf(); $mpdf->WriteHTML($template); $mpdf->Output(); // $mpdf->Output('sample.pdf','D'); ?>