You are on page 1of 1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

<?php

$rootDir = dirname(__FILE__); set_include_path($rootDir . '/../../lib/zf/library'


. PATH_SEPARATOR . get_include_path()); include 'Zend/Controller/Response/Http.php';

$filename = 'example.pdf'; $response = new Zend_Controller_Response_Http();


// set the HTTP headers $response->setHeader('Content-Type', 'application/pdf'); $response->setHeader('Content-Disposition', 'attachment; filename="'. $filename.'"'); $response->setHeader('Accept-Ranges', 'bytes'); $response->setHeader('Content-Length', filesize($filename)); // load the file to send into the body $response->setBody(file_get_contents($filename)); echo $response; ?>

You might also like