Search code examples
cocoafile-typeuti

what kind of file is public.composite-content (kUTTypeCompositeContent)?


i'm writing a file importer and want to handle pdf types. i see the com.adobe.pdf (kUTTypePDF) and also public.composite-content type.

Uniform Type Identifiers Reference docs :

Base type for mixed content. For example, a PDF file contains both text and special formatting data.

can someone kindly give an example of this type of file ?


Solution

  • The com.adobe.pdf identifier inherits from public.composite-content. In other words, PDF documents are a specific subset of all documents that conform to public.composite-content.

    As you can see in the reference documentation, there are many types that conform to public.composite-content, such as com.apple.rtfd (for RTF documents), com.apple.webarchive and public.presentation for presentation files (Keynote, Powerpoint etc).

    The main distinguishing feature of public.composite-content files is that they combine different specific types of data in one file, as opposed to types inheriting from public.data which are just binary blobs. I personally think the distinction is not exactly clear-cut but there you go.

    If you want to handle PDF types, you just need to declare conformance to com.adobe.pdf.