简体   繁体   中英

pdf display Content-Disposition: inline not working in php

want to display pdf in php so i created following code

$file = '../public/'.$ref;
header('Content-Type: application/pdf');
header('Content-Disposition: inline; filename="' . $filename . '"');
header('Content-Transfer-Encoding: binary');
header('Accept-Ranges: bytes');  

@readfile($file);

but browser showing weird contents , like below image在此处输入图片说明

i changed Content-Disposition in to attachment, its working fine but no luck in inline what i can do to fix this issue thanks in advance

finally code is working , i comment following lines in bootstrap.php file

 public static function sendResponse(Zend_Controller_Response_Http $response)
{
   //$response->setHeader('Content-Type', 'text/html; charset=iso-8859-1', true);
   $response->sendResponse();
}

but i need this charset in my response header , there is any other method?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM