Aqui tengo el método que permite convertir el html a pdf
Código:
y desde aqui lo llamo.. public function ReporteHorizontal($nombre, $html) {
$formato=array(15,15);
$pdf = $this->get("white_october.tcpdf")->create('landscape', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', true);
$pdf->SetAuthor('SIMANOT');
$pdf->SetTitle(('SIMANOT'));
$pdf->SetSubject('SIMANOT');
$pdf->setFontSubsetting(true);
$pdf->SetFont('freemono', '', 11, '', true);
$pdf->AddPage();
$filename = $nombre;
$pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'center', $autopadding = true);
$pdf->Output($filename . ".pdf", 'I'); // This will output the PDF as a response directly
}
Código:
Ojala me puedan ayudar... public function reporteAction($id) {
$em = $this->getDoctrine()->getManager();
$usuario = $this->get('security.context')->getToken()->getUser();
$role = strtolower($usuario->getRol());
$cedula = $usuario->getCedula();
$periodoactual = $em->getRepository('CARLOSsimanotBundle:Periodo')->getperiodoactual();
$materia = $em->getRepository('CARLOSsimanotBundle:Materia')->findOneBy(array('id' => $id));
$materiasxdocente = $em->getRepository('CARLOSsimanotBundle:DictadoMateria')->getmateriasdocente($cedula, $periodoactual->getId());
$datos = $em->getRepository('CARLOSsimanotBundle:MateriaAsignada')->getestudiantes($id, $periodoactual->getId());
$html = $this->renderView('CARLOSsimanotBundle:Docente:lista.html.twig', array(
'datos' => $datos,
'materiasxdocente' => $materiasxdocente,
'materia' => $materia,
'periodo' => $periodoactual,
));
$nombre = 'Reporte Estudiantes';
$this->ReporteHorizontal($nombre, $html);
}


