On 5/10/2009, at 4:12 AM, Sherm Pendley wrote:

On Sun, Oct 4, 2009 at 8:07 AM, Squ Aire <squ...@live.com> 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 filtering with only the pdf extension in open dialogs, and later ignore the non-valid PDF files?

I would take the second approach. First, it's going to perform better;
to filter the list in an open dialog, you'd have to open and verify
every .pdf file in the directory being shown. You'd also need to
inform the user somehow why some supposedly-pdf files are not
selectable. Also, note that Preview's open dialog will allow you to
select any file with a .pdf extension, then alerts the user if the
file's contents aren't actually PDF data.


You might also want to concider the oposite case - where a valid pdf does not
have a valid extension.


paulm

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to