Save the generated file in readonly Zend Pdf

468 views Asked by At

I am able to generate a pdf and show it to the browser. But when I save this pdf file on my desktop, open it and then close it its giving the alert "Do you want to save the changes?". I wish to create a readonly pdf document which customers cannot edit by any tool.

My code is

$this->getResponse()->setHeader('Content-type', 'application/pdf', true); 

$this->getResponse()->setHeader('Content-disposition','inline;filename='.$module.'_'.$m_no.'.pdf', true);

$this->getResponse()->setHeader('Cache-Control: no-cache, must-revalidate');

$this->getResponse()->setHeader('Content-Transfer-Encoding', 'binary', true);

$this->getResponse()->setHeader('Last-Modified', date('r'));    

$this->getResponse()->clearBody();    

$this->getResponse()->sendHeaders();

$this->getResponse()->setBody($pdf->render());

Any idea or suggestion to achieve the goal heartly welcomed. Thanks !

1

There are 1 answers

0
JamesG On BEST ANSWER

I assume you are trying to set restrictions in the document so that people can't manipulate the document using tools like Preview on OS X and Adobe Illustrator, etc.

Unfortunately this is not possible, at least not in Zend_Pdf in ZF1.12. And even if it was, there are several ready-made, easily accessible tools to defeat it, so it doesn't take much determination on part of the user to remove the protection.

http://www.wikihow.com/Unsecure-a-Secure-PDF-File