PDF files not recognised

Hi there, I’m using Scrivener for Mac 2.0.5 and noticed that it doesn’t recognise PDF files with no file extension.

Dragging a PDF called “notes pdf” into Research results in Scrivener displaying the binary content of the PDF instead of opening it for viewing. You have to rename the file “notes.pdf” and drag it in again to get it to open correctly in Scrivener. OS X correctly opens “notes pdf” without an extension.

Is this just how Scrivener works? Not a major issue just curious, so I can make sure all PDFs I need to import have file extensions. OS X doesn’t always add .pdf when you create one.


Yes, this is just how it works. Even now - despite the advent of various types of file identifiers - file extension is still the most reliable way of recognising a file. Thus Scrivener uses checks the file extension of the files it imports to determine how to treat them.

All the best,

And going forward, most OS X applications have a checkbox in the save dialogue which force appending an extension even if you do not supply one or have them visible in your Finder settings. It’s usually located at the very bottom, above the main Cancel/Okay buttons.

Actually, that checkbox should only specify whether the extension is visible in the Finder - it’s a file view setting, nothing more, and if you choose “Show all file extensions” in the Advanced tab of the Finder preferences you should see the file extensions of files that were created with that option unticked. In other words, ticking “Hide extension” in a save panel just tells the Finder not to show the extension unless “Show all file extensions” is selected; the file extension is still present, and Scrivener will still read it. Scrivener only has problems if there is no extension at all. You can find out by using Get Info in the Finder - most files that seem to have no file extension will still show a file extension in the “Name and Extension” area of the Get Info window; those that don’t genuinely have no extension at all. It’s quite unusual for a PDF file to have no extension at all, as in this case.

Out of interest, what program were these files created in? Have they been renamed manually or using a batch-renaming tool at all? I’m curious now as to how they have ended up with no extension. :slight_smile:

All the best,

Thanks all for the useful info. The PDF was a download from a Microsoft powered website (aspx) and downloaded as “haerviguide pdf”, no file extension. OS X knew it was a PDF though, even though it had no file extension as it knew how to open it, so I just assumed Scrivener would be the same.

When I dragged it into Scrivener it imported fine but when I clicked on the name in Scrivener it slowed down and showed the binary contents of the PDF.

So I removed the file from Scrivener, dragged it in again but this time checked “Import supported file types only”, thinking PDF wasn’t supported and I’d get a message to that fact but it let me import it even though it didn’t know what to do with it.

Perhaps include a warning message / option to associate a file with an application if there’s no file extension? Although I imagine such a scenario is very rare! I eventually opened a shell and did an ls on the file and it all fell into place!

Ah, thanks for the explanation - I blame Microsoft then. :slight_smile: In general it’s a fairly reasonable assumption to bring in files with no extensions as text files, although there are the odd exceptions, like this one. Moving forward I probably just need to explore different ways of checking file types if extension fails, although I’m not sure much is exposed to developers in that regard (I may well be missing something though).

Thanks and all the best,

FWIW I’m also a developer and used to have problems like this. Sometimes it’s possible to check the first few bytes of a file. PDF and ZIP files are easy in that respect:


but TBH it’s such a niggly thing in such a good app. I’d be happy with a wee message telling me to sort my file before importing!

Speaking as a developer, I am very impressed with what you’ve done with Scrivener. Quality software at a reasonable price. There are much more expensive things out there that aren’t worth half what they charge. You’ve got me out of Word and into something that makes writing documentation a breeze :slight_smile:

I would think that there is some library that lets you do what the “file” command will do. Under linux, it has no problems identifying a PDF with no extension (or even the string “pdf” anywhere in it’s name). I can only assume that the the same command in Mac OS X is based on libraries that you can gain access to, though I don’t know if you can use them in a commercial software.