onExport: (response) ->
window.open("data:application/pdf," + escape(response.text));
How should I handle the response to open/directly download the PDF file from the response ??
When I change the output to html, the html works like a charm.
Thanks a lot for any help
onExport: (response) -> // the response from jsreport server
template =
shortid : "N1PIxBjkl"
recipe: "phantom-pdf"
engine: "handlebars"
buffer = ?????? how to convert the response.text to a appropriate format
$('.export-data-options').html("");
pdfObject = $("<object type='application/pdf' style='width:100%;height:100%'></object>");
pdfObject.attr("data", "data:application/pdf;base64," + @arrayBufferToBase64(buffer));
$('.export-data').append(pdfObject);
###jsreport.render($(".export-data-options"), template);### - this worked for me
I hope you understand me, what I described.
Then I want to pass the request that way that I described - trough our API. The response is like it should be
But I don't have it parsed in arraybuffer format (https://github.com/jsreport/jsreport/blob/master/extension/embedding/public/js/embed.js#L104) and the pdf is blank