Checking whether a file is a genuine PDF file

2009-10-06 Thread Michele (Mike) Hjorleifsson
what about using a digital signature ? the current PDF standards and even ODF standards support a digital signature that would ensure the file hasnt been tampered with since it was signed. Though i guess you could create a garbage PDF and sign it if you wanted. Best Regards, Michele (M

Re: Checking whether a file is a genuine PDF file

2009-10-05 Thread Charles Srstka
On Oct 5, 2009, at 9:02 PM, James Walker wrote: FWIW, in the classic Mac OS, it was not uncommon to see a PDF with NO extension, but with the file type set to 'PDF '. Yes. Fortunately, if you have your application check the UTI instead of the filename extension, you'll always detect that it

Re: Checking whether a file is a genuine PDF file

2009-10-05 Thread Kyle Sluder
On Mon, Oct 5, 2009 at 6:30 PM, Graham Cox wrote: > This is true, but how far are you prepared to go? Others have suggested > checking a few bytes into the file's header which should be reasonable > enough, but I could create a file having a valid PDF header and garbage > thereafter... you cannot

Re: Checking whether a file is a genuine PDF file

2009-10-05 Thread James Walker
Graham Cox wrote: On 04/10/2009, at 11:07 PM, Squ Aire wrote: But that isn't good enough really, because a file can have the pdf extension without being a true PDF file. This is true, but how far are you prepared to go? Others have suggested checking a few bytes into the file's header whi

Re: Checking whether a file is a genuine PDF file

2009-10-05 Thread John Joyce
at sort of thing Sent from my iPhone On 2009/10/05, at 20:38, cocoa-dev-requ...@lists.apple.com wrote: Re: Checking whether a file is a genuine PDF file ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or

Re: Checking whether a file is a genuine PDF file

2009-10-05 Thread Charles Srstka
On Oct 5, 2009, at 8:30 PM, Graham Cox wrote: Most people would draw it with a simple check of the extension and maybe for files that traditionally have been subject to extension abuse (I don't think pdf is one of them) Well, in this day and age I believe you should actually be checking t

Re: Checking whether a file is a genuine PDF file

2009-10-05 Thread Graham Cox
On 04/10/2009, at 11:07 PM, Squ Aire wrote: But that isn't good enough really, because a file can have the pdf extension without being a true PDF file. This is true, but how far are you prepared to go? Others have suggested checking a few bytes into the file's header which should be re

Re: Checking whether a file is a genuine PDF file

2009-10-05 Thread Sean McBride
On 10/5/09 7:49 AM, Squ Aire said: >Thanks for the reply. However=2C of course a file can start with %PDF witho= >ut being a valid PDF file (and not openable by Preview). > >I think I found an acceptable way of doing my thing. Just include the Quart= >z framework and do > >PDFDocument *pdfDoc =3D

RE: Checking whether a file is a genuine PDF file

2009-10-05 Thread Squ Aire
Subject: Re: Checking whether a file is a genuine PDF file > From: sherm.pend...@gmail.com > To: squ...@live.com > CC: cocoa-dev@lists.apple.com > > On Sun=2C Oct 4=2C 2009 at 8:07 AM=2C Squ Aire wrote: >> >> I know that=2C in an open dialog for example=2C I can view

Re: Checking whether a file is a genuine PDF file

2009-10-04 Thread Paul M
On 5/10/2009, at 4:12 AM, Sherm Pendley wrote: On Sun, Oct 4, 2009 at 8:07 AM, Squ Aire wrote: How can I check whether a file is indeed a true PDF file (that can be, for example, opened in Preview)? Would I be able to filter true PDFs file in an open dialog, or would I just have to stick to

Re: Checking whether a file is a genuine PDF file

2009-10-04 Thread Sherm Pendley
On Sun, Oct 4, 2009 at 8:07 AM, Squ Aire wrote: > > I know that, in an open dialog for example, I can view all PDF files by just > filtering using the "pdf" file extension. But that isn't good enough really, > because a file can have the pdf extension without being a true PDF file. >From /usr/s

Checking whether a file is a genuine PDF file

2009-10-04 Thread Squ Aire
I know that, in an open dialog for example, I can view all PDF files by just filtering using the "pdf" file extension. But that isn't good enough really, because a file can have the pdf extension without being a true PDF file. How can I check whether a file is indeed a true PDF file (that can