Include pdf with printed data of a BD in another php file

0

I tried to include a pdf that prints data from a BD in a php file and I get errors. This pdf was made with the FPDF libraries.

This is the pdf code:

<?php
    require ('fpdf/fpdf.php');
    require ('src/autoload.php');
    require ('src/Fpdi.php');

    $nombre= $_POST['pdf'];
    $registro= $_POST['registro'];
    $folio= $_POST['folio'];
    $qr= $_POST['qr'];
    // $cedula= mysql_query("SELECT * FROM inscripcion where int_cedula=$cedula");
    // iniciar FPDI
    // $pdf=new FPDF();
    $pdf = new \setasign\Fpdi\Fpdi();
    // añadir una página
    $pdf->AddPage('o');
    // establecer el archivo de origen
    $pdf-> setSourceFile('IIICERTIFICADO.pdf');
    // importar página 1
    $tplIdx=$pdf->importPage(1);
    // use la página importada y colóquela en el punto 10,10 con un ancho de 200 mm (esta es la imagen del pdf incluido)
    $pdf->useTemplate($tplIdx, 16, 10, 265);
    // ahora escribe un texto encima de la página importada
    $pdf-> SetTextColor(0,0,0);
    $pdf-> SetFont('Arial', 'B', 21);
    $pdf->Image('QR.png' , 180 ,173, 40 , 38,'PNG', 'http://www.google');
    // modificacion del nombre
    $pdf-> SetXY(80, 16);
    $pdf-> Write(150,$nombre);
    // modificacion del registro
    $pdf-> SetXY(61, 16);
    $pdf-> Write(0,$registro);
    // modificacion del folio
    $pdf-> SetXY(250, 16);
    $pdf-> Write(0,$folio);

    $pdf->AddPage('o');
    $pdf-> setSourceFile('atras.pdf');
    $tplIdx=$pdf->importPage(1);
    $pdf->useTemplate($tplIdx, 0, 10, 288);
    $pdf-> SetTextColor(0,0,0);
    $pdf-> SetFont('Arial', 'B', 21);

    $pdf-> SetFont('Arial', 'B', 21);

    $pdf-> Output();
?>

And this is the home page where I want this pdf to be included:

<!DOCTYPE html>
<html lang="es" xml:lang="es">
<head>
  <title>Inicio</title>
  <link href="css/bootstrap.min.css" rel="stylesheet">
  <link href="css/bootstrap.min.css" rel="stylesheet">
  <link href="css/tuning.css" rel="stylesheet" type="text/css">
  <script src="js/jquery-1.12.4.js">
  </script>
  <script src="js/bootstrap.min.js">
  </script>
  <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
</head>
<body>
     <nav class="navbar navbar-inverse">
    <div class="container-fluid">
     <div class="navbar-header">
      <img src="Images/menu.png" width="100%">
    </div>
  </div>
  </nav>
  <?php

  $pdf='Paginas/contenidopdf.php';

  ?>

  <?php

  echo "Un $pdf";

  include 'Paginas/contenidopdf.php';
  include 'Clases/Conexion.class.php';

  echo "Un $pdf";

  ?>


  <footer class="footer">
 <img src="Images/cintillonew.png" width="100%">
  </footer>
</body>
</html>
    
asked by nelnic 10.12.2018 в 14:57
source

0 answers