Convert to PDF with php

Asked

Viewed 171 times

1

I have the following problem, I have these value in html with php (fetch the values from mysql): inserir a descrição da imagem aqui

And my goal would be through the use of materialize buttons gave the possibility to the user to make screenshot or turn these values into pdf so later they can print. inserir a descrição da imagem aqui

I’ve been searching and I thought the best would be to use to convert dompdf into pdf. Here’s the code I got:

<?php
use Dompdf\Dompdf;

// include autoloader
require_once 'dompdf/autoload.inc.php';
//criar a intancia
 $dompdf = new DOMPDF();

$dompdf->load_html(' 
  <h1>Não sei como meter aqui os valores</h1>
');
//renderizar
$dompdf->render();
//exibir pagina
  $dompdf->stream(
    "relatorio_pii.pdf",
    array(
      "Attachment"=> false 
    )
  )
?>

And now the code of my buttons:

<div class="fixed-action-btn click-to-toggle">
      <a class="btn-floating btn-large red">
        <i class="material-icons">menu</i>
      </a>
      <ul>
        <li><a class="btn-floating red"><i class="material-icons">save</i><input type="submit" name="submitpdf" value="Download pdf file" class="input-button"/></a></li>
        <li><a class="btn-floating yellow darken-1"><i class="material-icons">camera_alt</i></a></li>
        <li><a class="btn-floating blue"><i class="material-icons">show_chart</i></a></li>
      </ul>
    </div>

The problem is that I don’t know where to put the php formula to print and call on the print button. Please really appreciate your help.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.