Help with html2pdf

0

Good afternoon

I need help with the html2pdf, I want to automatically fill some fields of the document but doing tests and I do not detect the variables, This is the one that shows the data in the pdf

<!DOCTYPE HTML>

 <?php

session_start();
if (!isset($_SESSION['user_login_status']) AND $_SESSION['user_login_status'] != 1) {
    header("location: login.php");
    exit;
    }


require_once ("config/db.php");
require_once ("config/conexion.php");

$active_prestamos="active"; 
$title="Prestamos   | Simple Stock";
?>
<HTML lang="es">
<HEAD>

    <meta charset="UTF-8">
<title>Generar PDFs con PHP</title>
<style type="text/css">

    h2{
        color:darkslateblue;
    }


   </style>
 </HEAD>
<body>

 <h2>   hola</h2>
    <?php     
    $count_query   = mysqli_query($con, "SELECT count(*) AS numrows FROM $sTable  $sWhere");
    $row= mysqli_fetch_array($count_query);
    echo  $orden=$row['orden'];?>
    </body>
       </HTML>

and this is the one who calls him

            <?php
require __DIR__.'/vendor/autoload.php';

 use Spipu\Html2Pdf\Html2Pdf;


 ob_start();
 require_once 'pdf2.php';
 $html = ob_get_clean();

$html2pdf = new Html2Pdf('p','A4','es','true','UTF-8');
$html2pdf-> writeHTML($html);
$html2pdf->output('pdf_generated.pdf');

?>

and the error

  

(!) Notice: Undefined index: order in C: \ wamp64 \ www \ inventory \ pdf2.php on line 54   Call Stack

     

Time Memory Function Location

1 0.0010 240048 {main} () ... \ pdf.php: 0 2 0.0040 378992 require_once ('C: \ wamp64 \ www \ inventory \ pdf2.php') ... \ pdf.php: 8

    
asked by Kevin Salazar 19.10.2017 в 19:03
source

1 answer

1

You can also explore the use of the wkhtmltopdf utility published by link and that you can integrate into your script using the exec function. Ex:

   exec ("<WkhtmltopdfPATH>/wkhtmltopdf.exe  $PathArchivoHTML $PathArchivoPDFGenerado ");
    
answered by 20.10.2017 / 23:19
source