My contemplations and diurnal novelties are publicized here

Add a download button using following code:-

id=”pdfDownloadLink” target=”_blank” href=”#”><img
$this->baseUrl(); ?>/images/icon/downloadpdf.png”

Use following lines of jquery to change the href attribute on fly:-

$(“#pdfDownloadLink”).attr(‘href’, ‘<?php echo $this->serverUrl() . $this->baseUrl(); ?>/index.php/report/downloadpdf/file/?file=’ + encodeURIComponent(downloadURL));

In Zend the URL follow the following conventions


So providing file url will create problem so I used


You also need to add downloadpdf action to your controller

public function downloadpdfAction()   {

$params = $this->getRequest()->getParams();

$this->view->paramfile = $params[‘file’];


And in the view you can simple use following plain php code to download the file


$file= $this->paramfile;

header (“Content-type: octet/stream”);

header (“Content-disposition: attachment; filename=”.$file.“;”);

header(“Content-Length: “.filesize($file));





Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: