1 year ago

#314579

test-img

yas

Print generated pdf (with tcpdf) in an iframe after Ajax call

I'm using tcpdf to create pdf files with ajax call that send some data to pdf script for generating the pdf, then i would like to pass the pdf to iframe src

My tcpdf pdf creation ; last lines

    $p = header ("Content-Type: application/pdf");
    echo $pdf->Output('', 'S');

Ajax call

 var form = $("#submiEditCanevaForm");
        $.ajax({
            url: form.attr('action'),
            type: form.attr('method'),
            data: form.serialize(),
            success: function (data) {

                console.log(data);

                var blob = new Blob([data], { type: 'application/pdf' });
                var downloadUrl = URL.createObjectURL(blob);
                $('#pdf_file_edit').attr("src", downloadUrl);


   
            }


        });

enter image description here

jquery

ajax

iframe

tcpdf

0 Answers

Your Answer

Accepted video resources