This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Cannot create PDF in zend framework

atish1302 wrote on 2016-11-11:
 public function indexAction() {
    		//$url = "http://" . $_SERVER["SERVER_NAME"] . '/training/ecourse/certificate/demo.html';
    		//echo $url;
    		// create an API client instance
    		$client = new PdfCrowd("***", "***");

    		// convert a web page and store the generated PDF into a $pdf variable
    		$pdf = $client->convertURI('');
    		header('Content-Type: application/pdf');
    		//header("Cache-Control: max-age=0");
    		//header("Accept-Ranges: none");
    		header('Content-Disposition: attachment; filename="created.pdf"');

    		//echo $pdf;
    	       $this->_helper->viewRenderer->setNoRender ( true );
		$this->_helper->layout->disableLayout ();
    		// send the generated PDF
    	catch(Exception $why)
    		echo "Pdfcrowd Error: " . $why;

I am not able to create PDF using the above code. Is there anything wrong. I have tried 100 times so far.
support wrote on 2016-11-15:

Your code looks fine, are you getting any error messages?