Jquery print pdf contained in a string

I'm having some problems in the printing of a pdf. Using the following AJAX (that goes well, without any error) I retrive a string from print_invitee.php, passing some data ("data_e"), that contains a pdf made from an HTML.

My question is: how can I open the print window option with the content of "data" only using jQuery?

AJAX call:

$.ajax({
    method : "POST",
    url : "print_invitee.php",
    data : data_e,
    success : function(data) {
        if (data) {
            console.log(data.valueOf());
        }
    }
});

print_invitee.php:

function create_pdf_ricevuta_invitee(...*somecorrectparams*...) {
    $date = date("Y-m-d h:i:sa");
    $content = **...contentinhtml...**;
    $html2pdf = new HTML2PDF('P','A4','it');
    $html2pdf->WriteHTML($content);
    $content_PDF = $html2pdf->Output('', true);
    return $content_PDF;
}
echo create_pdf_ricevuta_inviter(...*somecorrectparams*...);

As you probably noticed I'm using http://html2pdf.fr/.

EDIT (add from comments): I'm on a server in which I can't create N pdf files.

Answers


Try to create PDF file and return link of that. Then you will get a link in ajax and handle it as you like (show PDF or link to PDF):

$content_PDF = $html2pdf->Output('exemple.pdf');

Need Your Help

bootstrap carousel pause not working

twitter-bootstrap carousel

I'm unable to invoke the 'pause' function on the Bootstrap (3.0.2) carousel. I've tried every way I can think of to refer to the carousel instance, but - no errors, no pause.