Generating pdfs in a new tab/page

At the moment i’m using a seperate button on my page to display the content of my (filtered) gridview on that page in a pdf document, when i click it the pdf shows in the current page and displays fine, but I would like it if the pdf showed in a new page/tab in my browser and i can’t get it to work… Any1 here who could help me?

Controller code:




public function actionIndex()

	{

		$this->pageTitle = "Leerlingregistratie - Aanwezigheden";

		$model=new VLnnAanw('search');

		$model->unsetAttributes();  // clear any default values

		if(isset($_GET['VLnnAanw']))

			$model->attributes=$_GET['VLnnAanw'];

	if (isset($_GET['btnPdf']))

                {

                     $dataProvider= $model->search();

                     $dataProvider->pagination= false; // for retrive all modules

                     $data = $dataProvider->getData();

        // MAKE PDF

        ...

        foreach ($data as $model){

        ...

        }

        $pdf->Output('overview.pdf', 'I');

                 }

        $this->render('lijstPersoneel',array(

			'model'=>$model,

		));

        }



What library are you using to generate pdf documents? … Have you tried adding pages/contents before trying to output it?

i’m using tcpdf.

Please see this topic and look for my replies.

On a side note, the output function in tcpdf should be the last line in your controller action. You don’t have to call render or renderPartial :)