Link to home
Create AccountLog in
Avatar of eduardo12fox
eduardo12foxFlag for Brazil

asked on

Link in PDF with mPDF

Hello everybody,

I need a help with mPDF, I'm using this class to generate PDF documents on the problem is that I need to generate some documents on pdf link where my client can click on the pdf and be redirected to a specific page.

If I use <a href> in one part of the document when it converts the link does not work, how can I solve this?
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Please post the test data you're using and the code you're using so we can install the same on our servers and test it together.  This question is not something that can be answered in the abstract -- we need to see specifics, thanks.
Avatar of eduardo12fox

ASKER

Sorry my distration in below the code

<?php
	
	ob_start();

?>
<!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>Untitled Document</title>
</head>

<body>
<table width="57%" border="1">
  <tr>
    <td width="62%" align="center">CLIENT</td>
    <td width="11%" align="center">DATE IN</td>
    <td width="27%" align="center">LINK PERFIL</td>
  </tr>
</table>
<?php

include "Conect.php";

$SQL = mysql_query("SELECT * FROM TABLE");
while($resp = mysql_fetch_array($SQL)){

?>
<table width="57%" border="1">
  <tr>
    <td width="62%" align="center"><?php echo $resp['client']; ?></td>
    <td width="11%" align="center"><?php echo $resp['data_in']; ?></td>
    <td width="27%" align="center"><a href="nextpage.php?Link<?php echo $resp['link']; ?>"><?php echo $resp['link']; ?></a></td>
  </tr>
</table>
<?php
}
?>
<?php

$html = ob_get_clean();
$html = utf8_encode($html);
define('MPDF_PATH', '');
include(MPDF_PATH.'../GerarPDF/mpdf.php');
$mpdf = new mPDF();
$mpdf->allow_charset_conversion=true;
$mpdf->SetFooter('{DATE j/m/Y  H:i}|{PAGENO}/{nb}| SOS');
$mpdf->charset_in='UTF-8';
$mpdf->addPage('L');
$mpdf->WriteHTML($html);
$mpdf->Output();
exit();

?>
</body>
</html>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of dmgroom
dmgroom
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Ok you were right put the absolute path and it worked correctly. thank you!
Ok you were right put the absolute path and it worked correctly. thank you!