Este es mi JavaScript:
Código Javascript:
Ver original
var options = { type: "GET", headers: "....", url: "ruta a ejecutar", data: data, contentType: 'application/json', dataType: "json", success: function(data, textStatus, jqXHR) { var winlogicalname = "detailPDF"; var winparams = 'width=850,height=1050'; //var htmlText = '<embed width="100%" height="100%" type="application/pdf" src="data:application/pdf,' + data + '"></embed>'; var detailWindow = window.open(winlogicalname, winparams); detailWindow.document.write(data); //detailWindow.document.write(htmlText); detailWindow.document.close(); }, error: function(xhr, status, error) { alert("Estado del error " + status + " Error " + error); } }; $.ajax(options);
Este es mi controlador de Symfony:
Código PHP:
Ver original
$html = $this->renderView('ReportBundle:Price:price.html.twig', $data); $filename = "export.pdf"; $basePath = $this->container->getParameter('kernel.root_dir'); } $this->get('knp_snappy.pdf')->generateFromHtml($html, $filename); $response = new Response($response, 200); $response->headers->set('Content-Description', 'PDF'); $response->headers->set('Content-Transfer-Encoding', 'binary'); $response->headers->set('Expires', '0'); $response->headers->set('Cache-Control', 'must-revalidate'); $response->headers->set('Pragma', 'public'); $response->sendHeaders(); return $response;
Pero el unico mensaje que me muestra es: "Estado del error parsererror Error SyntaxError: Unexpected end of input"
Si alguien me puede ayudar se lo agradeceria.