How to display a Japanese string inside HTML? - php

I am creating a PDF using DOMPDF. The pdf contains some images and strings. I am printing this values as php variables inside my HTML Layout and then converting HTML to PDF. Some of my strings are in Japanese. But it rendering in PDF as ????.
I used <meta http-equiv="Content-Type" content="text/html; charset=utf-8">. But nothing happends..
My code used is..
$bio_tbl = '<html style="margin:20px 20px 0px; padding:0;">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="margin:0; padding:0;">
<table style="vertical-align: top;">
<tr>
<td style="vertical-align: top;padding-top:4px;">'.$model_first_img.'</td>
<td style="vertical-align:top;">
<table style="margin:0px 0px 5px 3px;">
<tr>
<td style="width:220px;vertical-align:top;">'.$model_second_img.'</td>
<td style="width:220px;vertical-align:top;">'.$model_third_img.'</td>
</tr>
</table>
<table style="margin:0px 0px 5px 3px;">
<tr>
<td style="width:220px;vertical-align:top;">'.$model_forth_img.'</td>
<td style="width:220px;vertical-align:top;">'.$model_fifth_img.'</td>
</tr>
</table>
<table style="margin:0px 0px 0px 3px;">
<tr>
<td style="width:220px;vertical-align:top;">'.$text.'</td>
<td style="width:220px;vertical-align:top;"><img style="width:210px;height:210px;" src="'.$black_image_path.'"></td>
</tr>
</table>
</td>
<td>
<img src="'.$copy_img.'">
</td>
</tr>
<tr>
<td style="vertical-align:top;text-align:center;font-size:20px;margin-top:5px"><b><u>BIO</u></b></td>
</tr>
<tr>
<td style="vertical-align:top;">
<div style="text-align:left;font-size:14px; margin-bottom:10px; margin-top:10px;">'.$bio_text.'</div>
</td>
</tr>
</table>
</body>
</html>';
Converting to PDF using following code..
$dompdf = new DOMPDF();
$dompdf->set_base_path($path);
$dompdf->load_html($bio_tbl);
$dompdf->set_paper("a3", "portrait");
$dompdf->render();
$pdf = $dompdf->output();
$filename = $pdfname;
$dir = DRUPAL_ROOT .'/sites/default/files/temp_pdf/bio_'.$filename;
file_put_contents($dir,$pdf);
All helps appreciated..

Try to use :
$dompdf->load_html($content, 'UTF-8');

Related

How do I use Page Break in Dompdf laravel 5.5?

I'm having trouble designing the pdf of my system. here's a pic of my pdf:
What I want to do is to limit the number of items in the table by 10 items after that the rest goes to the next page with the same header and footer which is fixed already. just like this:
Purchase Request PDF
Here's my code:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PDF</title>
<link href="{{ asset('css/bootstrap.min.css') }}" rel="stylesheet">
<style>
#items tr{border:1px solid #000000;}
#items tbody tr td{border:1px solid #000000;}
#items thead td{background-color:#231F20;color:#FFFFFF;}
.header { position: fixed; left: 0px; top: -40px; right: 0px;}
.footer { position: fixed; left: 0px; bottom: 200px; right: 0px;}
</style>
<link rel="stylesheet" href="{{ asset('css/lato.css') }}">
<link href="https://fonts.googleapis.com/css?family=Libre+Barcode+128" rel="stylesheet">
</head>
<body>
<div class="container-fluid">
<div class="header">
<div class="row">
<div class="col-xs-3" style="font-family: 'Libre Barcode 128', cursive; font-size: 35px;padding: 10px 0px 0px 0px;">{{$pr->pr_form_no}}</div>
<div class="col-xs-9">
<table cellspacing='0' cellpadding='5' style="border-width: 0 !important;padding:0px 0px 0px 60px;">
<tr>
<td style="padding: 10px;"><img src="{{asset('images/sfclogo.png')}}" width="50px" height="50px"></td>
<td>
<table style="text-align: center;style='width:45%'">
<tr><td>REPUBLIC OF THE PHILIPPINES</td></tr>
<tr><td>PROVINCE OF LA UNION</td></tr>
<tr><td>CITY OF SAN FERNANDO</td></tr>
</table>
</td>
<th style="padding-top: 10px;padding-left: 10px"><p style="background-color: #000;color: #FFF; text-align: center;padding: 10px;">PR</p></th>
</tr>
</table>
</div>
</div>
<div class="row">
<div class="col-md-12" style="text-align: center;color: white;background-color: black; font-size: 18px">
PURCHASE REQUEST
</div><br>
</div>
<div class="row">
<table style='width:100%;border:1px solid #000000;font-size:11pt;' cellspacing='0' cellpadding='5' class='font1'>
<tr>
<td style='width:40%'>
<table style='width:90%;padding-right: 0px;' cellpadding='0' cellspacing='0'>
<tr>
<td style='width:100%;padding:1px;padding-left:10px;' colspan='2'>DEPARTMENT:</td>
</tr>
<tr>
<td style='width:100%;padding:0px;padding-left:10px;' colspan='2'>{{$dept->office_name}}<hr style='color:#000000;height:1px;margin-bottom:3px;margin-top:0px;padding-left:10px;' /></td>
</tr>
<tr>
<td style='width:15%;padding:1px;padding-left:10px;'>SECTION:</td>
<td style='width:75%;padding:0px;padding-left:0px;'>{{$section->office_name}}<hr style='color:#000000;height:1px;margin-bottom:3px;margin-top:0px;' /></td>
</tr>
</table>
</td>
<td style='width:30%;'>
<table style='width:90%;' cellpadding='0' cellspacing='0'>
<tr>
<td style='width:20%;padding:1px;'>PR No.</td>
<td style='width:70%;padding:0px;border-bottom:1px solid #000000;'>{{$pr->pr_form_no}}</td>
</tr>
<tr>
<td style='width:20%;padding:1px;'>SAI No.</td>
<td style='width:70%;padding:0px;border-bottom:1px solid #000000;'></td>
</tr>
<tr>
<td style='width:20%;padding:1px;'>ObR No.</td>
<td style='width:70%;padding:0px;border-bottom:1px solid #000000;'></td>
</tr>
</table>
</td>
<td style='width:30%'>
<table style='width:95%;' cellpadding='0' cellspacing='0'>
<tr>
<td style='width:15%;padding:1px;'>Date</td>
<td style='width:70%;padding:0px;border-bottom:1px solid #000000;'> {{$dt->toFormattedDateString()}}</td>
</tr>
<tr>
<td style='width:15%;padding:1px;'>Budget</td>
<td style='width:70%;padding:0px;border-bottom:1px solid #000000;'><strong> PHP {{number_format($pr->budget_alloc,2)}}</strong></td>
</tr>
<tr>
<td style='width:15%;padding:1px;'>Supplier</td>
<td style='width:70%;padding:0px;border-bottom:1px solid #000;'> {{$pr->supplier_type}}</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
<div class="footer">
<div class="row">
<table style='width:100%;border:1px solid #000000;font-size:12px;margin-left:auto;margin-right:auto;margin-top:40px;' cellspacing='0' cellpadding='3' class='font1'>
<tr>
<td style='width:39%; font-weight:bold;text-align:left;border:1px solid #000000;'>
REQUESTING OFFICE<br/><br/><br/><br/>
</td>
<td style='width:60%;border:1px solid #000000;vertical-align:top;font-weight:bold;' colspan='2' rowspan='3'>
PURPOSE<br/>
<div style='width:100%;text-align:center;font-weight:normal;font-size:11pt;' class='font1'>
{{$pr->purpose}}
</div>
</td>
</tr>
<tr>
<td style='border:1px solid #000000;height:19px;text-align:center;text-transform:uppercase;font-weight:bold;'>
{{$pr->requestor_name}}
</td>
</tr>
<tr>
<td style='text-align:center;border:1px solid #000000;text-transform:uppercase;height:19px;font-weight:bold'>
{{$pr->requestor_position}}
</td>
</tr>
<tr>
<td colspan='3' style='background-color:#000000;height:20px;'>
</tr>
<tr>
<td style='width:33%; font-weight:bold;text-align:left;border:1px solid #000000;'>
APPROPRIATION AVAILABLE
</td>
<td style='width:33%; font-weight:bold;text-align:left;border:1px solid #000000;'>
FUNDS AVAILABLE
</td>
<td style='width:33%; font-weight:bold;text-align:left;border:1px solid #000000;'>
APPROVED
</td>
</tr>
<tr>
<td style='border:1px solid #000000;height:25px;text-align:center;text-transform:uppercase;font-weight:bold;'>
</td>
<td style='border:1px solid #000000;height:25px;text-align:center;text-transform:uppercase;font-weight:bold;'>
</td>
<td style='border:1px solid #000000;height:25px;text-align:center;text-transform:uppercase;font-weight:bold;'>
</td>
</tr>
<tr>
<td style='width:33%; font-weight:bold;text-align:center;border:1px solid #000000;text-transform:uppercase;'>
{{$aa->name}}<br/>
{{$aa->position}}
</td>
<td style='width:33%; font-weight:bold;text-align:center;border:1px solid #000000;text-transform:uppercase;'>
{{$c->name}}<br/>
{{$c->position}}
</td>
<td style='width:33%; font-weight:bold;text-align:center;border:1px solid #000000;text-transform:uppercase;'>
{{$approval->name}}<br/>
{{$approval->position}}
</td>
</tr>
</table>
</div>
<div class="row">
<div style='float:left;font-weight:normal;font-style:italic;font-size:7pt;width:40%;text-align:left;'>{{$created_code}}</div>
</div>
</div>
<div class="content" >
<div class="row">
<table style='width:100%;font-size:14px;text-align:center;border:1px solid #000000;' id='items' cellpadding='0' cellspacing='0'>
<thead>
<tr>
<td style='width:7%;font-weight:bold;'>ITEM NO.</td>
<td style='width:7%;font-weight:bold;'>QTY</td>
<td style='width:7%;font-weight:bold;'>UNIT</td>
<td style='width:49%;font-weight:bold;'>DESCRIPTION</td>
<td style='width:15%;font-weight:bold;'>ESTIMATED UNIT OF</td>
<td style='width:15%;font-weight:bold;'>ESTIMATED COST</td>
</tr>
</thead>
<tbody >
#foreach($list as $indexKey => $list)
<tr>
<td>{{$indexKey}}</td>
<td>{{$list->pr_qty}}</td>
<td>{{$list->pr_unit}}</td>
<td>{{$list->pr_description}}</td>
<td style='text-align: right;'>{{$list->pr_cost_per_unit}}</td>
<td style='text-align: right;'>{{$list->pr_estimated_cost}}</td>
</tr>
#if($indexKey >= 9)
#break
#endif
#endforeach
#for($i = $count; $i < 10; $i++)
<tr><td> </td><td> </td> <td> </td><td> </td><td> </td><td> </td></tr>
#endfor
</tbody>
<tfoot>
<tr style="background-color: #b0b1b2;">
<td colspan="5" style="text-align: right; font-weight: bold;">GRAND TOTAL</td>
<td style="text-align: right; font-weight: bold;">
{{number_format($grand_total,2)}}
</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
<script src="{{ asset('js/jquery.min.js') }}"></script>
<script src="{{ asset('js/bootstrap.min.js') }}"></script>
</body>
</html>
I already attempted to use the break function of the blade to stop the loop when the items shown is already 10.
*Also sorry if the code looks like hell.
you can use some css styling for it just like below:
<style>
.page-break {
page-break-after: always;
}
</style>
<h1>page</h1>
<div class="page-break"></div>
<h1>Someother Page</h1>
if you want to make a page break after for example 5 divs then you can do something like this:
#php $check=0 #endphp
#foreach($array as $item)
#php $check++ #endphp
<!-- your code or something like divs -->
#if( $check % 5 == 0 )
#php echo '<div class="page-break"></div>'; #endphp ....
#endif
#endforeach
Hope you will get the idea from it.

mb_convert_encoding(): Unable to detect character encoding in DOMPDF Laravel 5.5

I am using Laravel 5.5 for developing Application, For The Generation of PDF I am using laravel dompdf Package
Here is Link: https://github.com/barryvdh/laravel-dompdf
I was already Created issue on Github for this .
Here is My Laravel Code:
public function ViewPDF($id)
{
$product = Product::find($id);
$category = Category::find($product->category_id);
$product_line = ProductLine::find($product->product_line_id);
$template = View('product_and_category/PDF_Template', ['data'=>$product]);
return $this->GeneratePDF($template);
}
public function GeneratePDF($html) {
$pdf = \App::make('dompdf.wrapper');
$pdf->loadHTML($html);
return $pdf->stream();
}
Here is HTML , I have Already Added the UTF-8 in My HTML, But still having the same issue its looking like bug in the package.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Title</title>
</head>
<body style="margin:0px;">
<section style="width:100%; margin:0; text-align:center;">
<div style="background:url({{asset('/images/red-nav-bg.jpg') }}) repeat-x 0px 68px #702425;">
<img src="{{ asset('/images/logo.png') }}" width="auto" height="auto" alt="logo" />
</div>
</section> <!---**** Section Close ****--->
<div style="width:1100px; margin:30px auto; text-align:center;">
<img src="assets/images/doorImg2.jpg" width="auto" height="auto" alt="logo" style="padding: 30px 40px; border: 1px solid #cdced1;" />
</div>
<div style="width:1100px; margin:0 auto;">
<table width="100%" border="1" cellspacing="0" cellpadding="10" style="margin-bottom:30px; font-size:14px; border-color:#cdced1; font-family:sans-serif;">
<tr>
<td>Category</td>
<td>adsfdsaf</td>
</tr>
<tr>
<td>Product Line</td>
<td>Draft beer systems & refrugeration</td>
</tr>
<tr>
<td>Model #</td>
<td>D-36-18RL</td>
</tr>
<tr>
<td>Description</td>
<td>36" L x 18"D stainless steel sink</td>
</tr>
<tr>
<td>Cost</td>
<td>$</td>
</tr>
<tr>
<td>Number of Faucets</td>
<td>8</td>
</tr>
<tr>
<td>Material Finishes</td>
<td>QF_Metal - Mirror - Finished</td>
</tr>
<tr>
<td>Dimension</td>
<td>15 7/8</td>
</tr>
</table>
</div>
<div style="width:100%; margin:0 auto; background-color:#f9f9f9; text-align:center; padding:30px 0px; font-size:13px; color: #ccc; font-family:sans-serif;">
<p style="margin: 0px;">© 2017 Copyrights</p>
</div> <!---**** Footer Close ****--->
</body>
</html>
Some HTML Tags are not encoded in DOMPDF that's why i was facing this error
after some clean up in html template working fine
The reason you are recieving this error is because you have included a dollar sign $, it does not recognise the dollar sign remove it and you should be fine.

Using DomPDF to generate table list from database

I have the following code for generating HTML content to PDF using DomPDF.and my problem focuses on this line
$pdf_content='<!DOCTYPE html PUBLIC "-//W3C//DTD...
The entire code
<?php
error_reporting(0);
require_once ('dompdf_config.inc.php');
$pdf_content='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<style type="text/css">
#pdf_header, #pdf_container{ border: 1px solid #CCCCCC; padding:10px; }
#pdf_header{ margin:10px auto 0px; border-bottom:none; }
table{ width:580px; }
#pdf_container{margin:0px auto; }
.rpt_title{ background:#99CCFF; }
</style>
<body>
<div id="pdf_header" >
<table border="0" cellspacing="1" cellpadding="2">
<tr id="hdRow">
<td width="20%"><img src="space_age_header.jpg" style="width:250px" ></td>
<td width="30%" align="center">Sample File</td>
<td width="30%" align="left">Marimuthu<br>User Code : 179865420</td>
</tr>
</table>
</div>
<div id="pdf_container" >
<table border="0" cellspacing="1" cellpadding="2">
<tr align="center" bgcolor="pink" style="color:#FFF"><td colspan="3"><b>Your Statement Summery</b></td> </tr>
<tr bgcolor="#006" style="color:#FFF"><td colspan="3" align="left">Your Heading.</td></tr>
</table>
<table> <tr> <td> Name </td><td> Department</td><td>Total </td><td>Grade </td> </tr>
<tr> <td> Marimuthu </td><td> Admin</td><td>250 </td><td>A </td> </tr>
</div></body></html>'
;
$name = date("Ymd").rand().'.pdf';
$reportPDF=createPDF(12, $pdf_content, 'activity_Report', $name );
function createPDF($pdf_userid, $pdf_content, $pdf_For, $filename){
$path='UsersActivityReports/';
/*$rndNumber=rand();
$filename=$pdf_userid.date("Ymd").$rndNumber.'.pdf';*/
$dompdf=new DOMPDF();
$dompdf->load_html($pdf_content);
$dompdf->render();
$output = $dompdf->output();
file_put_contents($path.$filename, $output);
return $filename;
}
echo '<a href="UsersActivityReports/'.$name.'" > Download </a>';
?>
I have extracted the $pdf_content='<!DOCTYPE html PUBLIC "-//W3C//DTD... part to another page page.php and modified it to allow generating files from database using a do while loop.
<?php
include("../../Connections/dbConfig.php");
$query_record = mysqli_query($link,"SELECT * FROM `subjects`") or
die (mysqli_error($link));
$row_record = mysqli_fetch_assoc($query_record);
$totalRows_record = mysqli_num_rows($query_record);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<style type="text/css">
#pdf_header, #pdf_container{ border: 1px solid #CCCCCC; padding:10px; }
#pdf_header{ margin:10px auto 0px; border-bottom:none; }
table{ width:580px; }
#pdf_container{margin:0px auto; }
.rpt_title{ background:#99CCFF; }
</style>
<body>
<div id="pdf_header" >
<table border="0" cellspacing="1" cellpadding="2">
<tr id="hdRow">
<td width="20%"><img src="space_age_header.jpg" style="width:250px" ></td>
<td width="30%" align="center">Sample File</td>
<td width="30%" align="left">Marimuthu<br>User Code : 179865420</td>
</tr>
</table>
</div>
<div id="pdf_container" >
<table border="0" cellspacing="1" cellpadding="2">
<tr align="center" bgcolor="pink" style="color:#FFF"><td colspan="3"><b>Your Statement Summery</b></td> </tr>
<tr bgcolor="#006" style="color:#FFF"><td colspan="3" align="left">Your Heading.</td></tr>
</table>
<table>
<tr> <td> Subject </td><td> Code </td><td>Total </td><td>Grade </td> </tr>
<?php do { ?>
<tr> <td> <?php echo $row_record['subject']; ?> </td><td> <?php echo $row_record['code']; ?> </td><td>250 </td><td>A </td> </tr>
<?php } while ($row_record = mysqli_fetch_assoc($query_record)); ?>
</table>
</div></body></html>
Now this is where i am stuck. How do i implement this. How do i return the dynamically generated code back to the
$pdf_content='
and make it work.
$pdf_content= include('page.pp'); //something like this doesn't seem to work
I welcome any alternative idea on the same
The main thing to note about your code changes is that the HTML is now outside of a code block. This means that PHP will send that code to the browser as it's processed. To get around this you would need to enable output buffering to capture the rendered text.
ob_start();
include('page.php');
$pdf_content = ob_get_clean();
ob_end_clean();
Note that some systems may limit the size of the output buffer (see the output_buffering setting). You can check that using ini_get('output_buffering');. If a limit is enabled make sure the size of your rendered HTML is less than the maximum size of the buffer.

How to put a table in the end of the content

okay, so my head is going to explode right now, i'm searching 5 hours non stop for my problem..
i want the menu2.html which is inside a table, to appear on the end of the page, After the end of the Content!
i tried a lot, like:
1-position: absolute; bottom: 0;
2-position: absolute; left: 100px; top: 150px; etc etc...
But this is not what im looking for!
I could put the menu2 after the content only by editing the top:150 But there are a lot of pages with different contents, so the menu2 doesn't suit in the other pages!
I hope you can help me.
This Is My PHP file:
<style type="text/css">
.menu2 {
background-image: url('<?=$profpic;?>');
background-attachment:fixed;
background: yellow;
}
</style>
<title>Hello</title>
</head>
<body>
<table width="100%" height="58%" border="0" cellspacing="0" cellpadding="2" class="heading">
<tr>
<td>
<?php include('menu.html');?>
</td>
</tr>
<tr>
<td><img src="pictures/logo.png" width="1335" height="300"></td>
</tr>
</table>
<table width="85%" height="1%" border="1" cellspacing="0" cellpadding="2">
<tr>
<td>
<?php include('menu2.php');?>
</td>
</tr>
</table>
<?php
$profpic = "pictures/bg.jpg";
?>
</body>
</html>
It's not clear to me what you are trying to do here, but I'll take a shot at helping you. First of all, you can't have multiple <html>, <head>, and <body> tags on the same page. Only one set of these are allowed. Secondly, change the file type of menu2 to php instead of html if you want to include it there.
<style type="text/css">
.menu2 {
background-image: url('<?=$profpic;?>');
background-attachment:fixed;
position: absolute;
background: yellow;
}
</style>
<title>Hello</title>
</head>
<body>
<table width="100%" height="58%" border="0" cellspacing="0" cellpadding="2" class="heading">
<tr>
<td>
<?php include('menu.html');?>
</td>
</tr>
<tr>
<td><img src="pictures/logo.png" width="1335" height="300"></td>
</tr>
</table>
<table width="85%" height="1%" border="1" cellspacing="0" cellpadding="2">
<tr>
<td>
<?php include('menu2.php');?>
</td>
</tr>
</table>
<?php
$profpic = "pictures/bg.jpg";
?>
</body>
</html>
menu2.php
<div class="menu2">
//menu2 contents
</div>

HTMl Table's border not showing on Php PDF

Why do the borders of my tables not appear when I print my pdf to the screen?
I'm using the mPDF library.
I create the tables in html and for some reason it is not showing.
I already tried using inline CSS but it didn't work, for me.
<?php
require_once 'MPDF57\MPDF57\mpdf.php';
class TablePDF {
public function printPDF() {
$mpdf = new mPDF();
$border = 2 ;
$mpdf->SetHeader("Tabela");
$mpdf->SetFooter("Tabela");
$htmlpdf= "
<html>
<head>
<link type='text/css' rel=' rel='heet' href=' href='tstrap.min.css'>
<link type='text/css' rel='stylesheet' href='css/estilo.css'>
<style type='.text/css.'>
<title>Table</title>
</style>
.td{
style='border: 1px solid';
}
</head>
<body>
<table class='tabela' border=".$border." style='border:10px solid;'>
<tr style='border:10px solid black'>
<th width='150' style='border:10px solid black; '>GE</th>
<td width='200' style='border:10px solid black; '>0</td>
<td width='200' style='border:10px solid black; '><strong>Nome Curto</strong></td>
<td width='200' style='border:10px solid black; '>0</td>
</tr>
</table>
<table class='tabela' border=".$border." style='border:10px solid black'>
<tr>
<th width='150'>Valor</th>
<td width='200'>0</td>
<td width='200'><strong>FG</strong></td>
<td width='200'>0</td>
</tr>
</table>
<table class='tabela' border=".$border." style='border:10px solid black'>
<tr>
<th width='150'> Jugular </th>
<td width='117'>0</td>
<td width='117'>0</td>
<td width='117'>0</td>
<td width='118'>0</td>
<td width='119'>0</td>
</tr>
</table>
<table class='tabela' border=".$border." style='border:10px solid black'>
<tr>
<th width='150'>EXP3D</th>
<td width='200'>0</td>
<td width='200'>0</td>
<td width='200'>0</td>
</tr>
</table>
<table class='tabela' border=".$border." style='border:10px solid black'>
<tr>
<th width='150'>EXP28D</th>
<td width='200'>0</td>
<td width='200'>0</td>
<td width='200'>0</td>
</tr>
</table>
<table class='tabela' border=".$border." style='border:10px solid black'>
<tr>
<th width='150'>Carotida</th>
<td width='303'>0</td>
<td width='303'>0</td>
</tr>
</table>
</body>
</html>";
$mpdf -> useOnlyCoreFonts = true;
$mpdf->WriteHTML($htmlpdf);
$mpdf->Output();
}
}
?>
Then I use this to use this function to print the pdf:
<?php
require_once 'TablePDF.php';
$var = new TablePDF();
$var->printPDF();
?>
EDIT: the problem has been solved, i just started deleting the table class in the TABLE tag line because for some reason it wastn recognizing it as a class.
thanks alot folks.
td {
border: 1px solid;
}
You don't have to create style every time that you need to use a td in your page, you only call the style.

Categories