Download PDF file

0
  

Jquery

The information of inputText is sent:

Send button:

$.ajax({
  data:{
  "alumno":$("#txt_nombre").val(),
  "matricula":$("#txt_matricula").val(),
  "carrera":$("#txt_carrera").val(),
  "grupo":"ewq",
  "celular":$("#txt_celular").val(),
  "email":$("#txt_email").val(),
  "nivel":$("#sel_modulo").val(),
  "pago":$("#sel_pago").val(),
  "grupo_ins":$("#sel_grupo").val(),
  "horario":$("#txt_horasi").val(),
  "docente":$("#txt_docasi").val(),

},
  url:"php/format_f.php",
  type:"POST",
  beforeSend: function(){

  },
    success:function(vista){
        Mensaje("verde","correctamennte enviado");
    }
});
  

File format_f.php

    <?php
  ob_start();

  ?>
  <!DOCTYPE html>
  <html>
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
      <meta charset="utf-8">
      <title>ResultadoEXAM</title>
    </head>
    <body style="">
        <img src="formatos/header.jpg" style="width:100%;" />
        <center><h3>INSTITUCION</h3>
      <h4>XXXXX</h4>
      <h4>XXXXX</h4>
      <h3>XXXXX</h3></center>

      <center><img src="formatos/icono.png" style="width:80px;" /></center>
      <br><br>

        <h5>FICHA DE INSCRIPCIÓN DEL “YYYYY“ </h5>
        <h5 style="position:absolute; left:0;">DATOS DEL ALUMNO</h5><h5 style="position:absolute; right:0;">Fecha: <?php $_POST['fecha'];?></h5>
        <br>
        <br>
        <h5 style="position:absolute; left:0;"><strong>Nombre:</strong> <?php $_POST['alumno'] ?><h5 style="position:absolute; right:0;"><strong>Matricula:</strong> <?php $_POST['matricula'];?></h5>
        <br>
        <h5 style="position:absolute; left:0;"><strong>Carrera:</strong> <?php $_POST['carrera']?><h5 style="position:absolute; right:0;"><strong>Grupo:</strong> <?php $_POST['grupo'];?></h5>
        <br>
        <h5 style="position:absolute; left:0;"><strong>Celular:</strong> <?php $_POST['celular'] ?><h5 style="position:absolute; right:0;"><strong>E-Mail:</strong> <?php $_POST['email'];?></h5>
        <br><br>
        <h5><strong>Nivel a cursar:</strong> <?php $_POST['nivel'];?></h5>
        <h5><strong>Forma de pago:</strong> <?php $_POST['pago'];?></h5>
        <br><br>
        <h5 style="position:absolute; left:0;">DATOS DE HORARIO Y GRUPO</h5><br>
        <h5><strong>Grupo inscrito:</strong> <?php $_POST['grupo_ins'];?></h5>
        <h5><strong>Horario seleccionado:</strong> <?php $_POST['horario'];?></h5>
        <h5><strong>Docente asignado:</strong> <?php $_POST['docente'];?></h5>

        <br><br><br><br>
        <h5 style="position:absolute; left:0;">_____________________</h5><h5 style="position:absolute; right:0;">_____________________</h5>
        <br>
        <h5 style="position:absolute; left:0;">Firma alumno</h5><h5 style="position:absolute; right:0;">Coordinadora de idiomas</h5>

<footer style="position:absolute; bottom:0;">
  <img src="formatos/footer.jpg" style="width:100%;" />
</footer>
    </body>
    <style media="screen">
    *{
      font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
    }
    strong{
      color:#999;
      font-style: oblique;
    }
        h4,h5{
          margin:0px;
        }
        h3{
          margin:15px;
          font-size:25px;
        }
        h4{
          color:#555;
          font-size:15px;
        }
        h5{
          font-size:18px;
          font-weight: 100;
        }
    </style>
  </html>
  <?php
  require_once ("dompdf/dompdf_config.inc.php");
  $dompdf = new DOMPDF();
  $dompdf->load_html(ob_get_clean());
  $dompdf->render();
  $pdf=$dompdf->output();
  $filename = 'nombre.pdf';
  $dompdf->stream($filename, array("Attachment" => 1));
 ?>

Here supposedly you should be receiving the information and generating the PDF format, the problem is that you do not download the file. It simply does not do anything by pressing the send button Eye! I use the dompdf library to generate the file.

    
asked by DoubleM 11.12.2017 в 06:37
source

0 answers