Hi Tobias, Yes, that's not a big deal to check PDF header and for example trailer. So such "isPdf()" function shouldn't use a lot of resources. But offered workaround may do this. Zend_Pdf::load() method parses object reference tables and preloads some objects (ex. pages structure). With best regards, Alexander Veremyev.
_____ From: Tobias Gies [mailto:[EMAIL PROTECTED] Sent: Thursday, September 20, 2007 3:06 PM To: Zend Framework General Subject: Re: [fw-general] Validate PDF? Hi gu problem is, you will have to open the file anyway to get the first bytes of the file (i.e., the PDF file header), so I'm unsure if this is actually that much overhead :) Greetings Tobias 2007/9/20, Alexander Veremyev <HYPERLINK "mailto:[EMAIL PROTECTED]"[EMAIL PROTECTED]>: PS I just saw you already created JIRA issue :) With best regards, Alexander Veremyev. _____ From: Alexander Veremyev [mailto:HYPERLINK "mailto:[EMAIL PROTECTED]" [EMAIL PROTECTED] Sent: Thursday, September 20, 2007 2:45 AM To: Jack Sleight Cc: Zend Framework General Subject: RE: [fw-general] Validate PDF? Hi Jack, Yes, please do this. Or (if you don't have JIRA account yet) I can add this. Yes, you can try to load it and check if an exception is thrown. The side effect is actual PDF loading :) (that's possible you don't need it) With best regards, Alexander Veremyev. _____ From: Jack Sleight [mailto:HYPERLINK "mailto:[EMAIL PROTECTED]" [EMAIL PROTECTED] Sent: Wednesday, September 19, 2007 4:41 PM To: Alexander Veremyev Cc: Zend Framework General Subject: Re: [fw-general] Validate PDF? Hi Alexander, Ok, should I add it to the issue tracker? In the meantime, would something like this do the job (as a quick hack): function validatePdf($fileName) { try { Zend_Pdf::load($fileName); } catch (Zend_Pdf_Exception $e) { return false; } return true; } Alexander Veremyev wrote: Hi Jack, No. But it's good idea. With best regards, Alexander Veremyev. No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.487 / Virus Database: 269.13.22/1015 - Release Date: 18.09.2007 11:53 -- Jack No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.487 / Virus Database: 269.13.22/1015 - Release Date: 18.09.2007 11:53 No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.487 / Virus Database: 269.13.22/1015 - Release Date: 18.09.2007 11:53 No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.487 / Virus Database: 269.13.22/1015 - Release Date: 18.09.2007 11:53 No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.487 / Virus Database: 269.13.22/1015 - Release Date: 18.09.2007 11:53 No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.487 / Virus Database: 269.13.25/1018 - Release Date: 19.09.2007 15:59 No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.487 / Virus Database: 269.13.25/1018 - Release Date: 19.09.2007 15:59