Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Generate PDF using jquery ajax

i am working with phalcon php framework. I want to send data displayed in a div tag(it is a result of a search)to controller function, and controller will generate pdf file. But, pdf file is not generating. Here is my view:

  var imenica = "Ja se zovem Nedim Omerbegovic";
        url: '<?php echo  $this->url->get("test/creatingpdf");?>',
        type: 'POST',
        dataType: '',
        data: {imenica:imenica},
        success: function(data){
            } ,
            error: function(){


and here is code for controller:

public function creatingpdfAction(){
    $string =$_POST['imenica'];

          $loader = new \Phalcon\Loader();
    "mpdf"=> "C:/wamp/www/phalcon1/mpdf/mpdf.php"

    //$string = "Ja se zovem Nedim Omerbegovic";
    $view = new \Phalcon\Mvc\View();
    $cont = $this->view->getRender('test', 'creatingpdf');
    //generisanje pdf dokumenta
    $pdf = new mpdf();
    $pdf->WriteHTML($cont, 2);
    $br = rand(0,100000);
    $ispis = "Pobjeda Rudet-Izvjestaj-".$br;
    $pdf->Output($ispis, 'I');

How can i see generated pdf file in this way of warking. Please, if anyone knows help me.

Hi there To generate pdf files using code is so difficult for me.However ,i usually do the pdf generating using this program: It's very convenient to process pdf files.Hope to help you.