By friedo


2008-11-23 06:49:08 8 Comments

When working with PDFs, I've run across the MIME types application/pdf and application/x-pdf among others.

Is there a difference between these two types, and if so what is it? Is one preferred over the other?

I'm working on a web app which must deliver huge amounts of PDFs and I want to do it the correct way, if there is one.

3 comments

@Lucky 2015-12-14 08:31:27

From Wikipedia Media type,

A media type is composed of a type, a subtype, and optional parameters. As an example, an HTML file might be designated text/html; charset=UTF-8.

Media type consists of top-level type name and sub-type name, which is further structured into so-called "trees".

top-level type name / subtype name [ ; parameters ]

top-level type name / [ tree. ] subtype name [ +suffix ] [ ; parameters ]

All media types should be registered using the IANA registration procedures. Currently the following trees are created: standard, vendor, personal or vanity, unregistered x.

Standard:

Media types in the standards tree do not use any tree facet (prefix).

type / media type name [+suffix]

Examples: "application/xhtml+xml", "image/png"

Vendor:

Vendor tree is used for media types associated with publicly available products. It uses vnd. facet.

type / vnd. media type name [+suffix] - used in the case of well-known producer

type / vnd. producer's name followed by media type name [+suffix] - producer's name must be approved by IANA

type / vnd. producer's name followed by product's name [+suffix] - producer's name must be approved by IANA

Personal or Vanity tree:

Personal or Vanity tree includes media types created experimentally or as part of products that are not distributed commercially. It uses prs. facet.

type / prs. media type name [+suffix]

Unregistered x. tree:

The "x." tree may be used for media types intended exclusively for use in private, local environments and only with the active agreement of the parties exchanging them. Types in this tree cannot be registered.

According to the previous version of RFC 6838 - obsoleted RFC 2048 (published in November 1996) it should rarely, if ever, be necessary to use unregistered experimental types, and as such use of both "x-" and "x." forms is discouraged. Previous versions of that RFC - RFC 1590 and RFC 1521 stated that the use of "x-" notation for the sub-type name may be used for unregistered and private sub-types, but this recommendation was obsoleted in November 1996.

type / x. media type name [+suffix]

So its clear that the standard type MIME type application/pdf is the appropriate one to use while you should avoid using the obsolete and unregistered x- media type as stated in RFC 2048 and RFC 6838.

@T Nguyen 2018-08-01 20:04:59

Why in the world would you go back to 7-year-old question (at the time) to give a very long answer to a question which has been answered very well (twice!)? You, sir, have way too much time on your hands.

@sunil 2018-08-13 13:51:31

@TNguyen: No harm. :) I think it is good to have other versions of answers, so that it will provide some additional info for one who search the topic. Also, he quoted some additional info, while compared to other answers.

@Chris Hanson 2008-11-23 07:22:44

The standard MIME type is application/pdf. The assignment is defined in RFC 3778, The application/pdf Media Type, referenced from the MIME Media Types registry.

MIME types are controlled by a standards body, The Internet Assigned Numbers Authority (IANA). This is the same organization that manages the root name servers and the IP address space.

The use of x-pdf predates the standardization of the MIME type for PDF. MIME types in the x- namespace are considered experimental, just as those in the vnd. namespace are considered vendor-specific. x-pdf might be used for compatibility with old software.

@GargantuChet 2010-12-29 12:13:22

This is a convention defined in RFC 2045 - Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies.

  1. Private [subtype] values (starting with "X-") may be defined bilaterally between two cooperating agents without outside registration or standardization. Such values cannot be registered or standardized.

  2. New standard values should be registered with IANA as described in RFC 2048.

A similar restriction applies to the top-level type. From the same source,

If another top-level type is to be used for any reason, it must be given a name starting with "X-" to indicate its non-standard status and to avoid a potential conflict with a future official name.

(Note that per RFC 2045, "[m]atching of media type and subtype is ALWAYS case-insensitive", so there's no difference between the interpretation of 'X-' and 'x-'.)

So it's fair to guess that "application/x-foo" was used before the IANA defined "application/foo". And it still might be used by folks who aren't aware of the IANA token assignment.

As Chris Hanson said MIME types are controlled by the IANA. This is detailed in RFC 2048 - Multipurpose Internet Mail Extensions (MIME) Part Four: Registration Procedures. According to RFC 3778, which is cited by the IANA as the definition for "application/pdf",

The application/pdf media type was first registered in 1993 by Paul Lindner for use by the gopher protocol; the registration was subsequently updated in 1994 by Steve Zilles.

The type "application/pdf" has been around for well over a decade. So it seems to me that wherever "application/x-pdf" has been used in new apps, the decision may not have been deliberate.

Related Questions

Sponsored Content

20 Answered Questions

[SOLVED] Recommended way to embed PDF in HTML?

  • 2008-11-14 23:55:13
  • Daniel Silveira
  • 1143009 View
  • 986 Score
  • 20 Answer
  • Tags:   html pdf

16 Answered Questions

[SOLVED] How to find the mime type of a file in python?

  • 2008-09-04 12:07:27
  • Daren Thomas
  • 123841 View
  • 140 Score
  • 16 Answer
  • Tags:   python mime

15 Answered Questions

[SOLVED] Merge / convert multiple PDF files into one PDF

35 Answered Questions

[SOLVED] What is the correct JSON content type?

  • 2009-01-25 15:25:19
  • Oli
  • 2208438 View
  • 9218 Score
  • 35 Answer
  • Tags:   json content-type

30 Answered Questions

[SOLVED] Convert HTML + CSS to PDF with PHP?

5 Answered Questions

[SOLVED] Setting mime type for excel document

14 Answered Questions

[SOLVED] Proper MIME type for fonts

  • 2010-05-20 07:09:08
  • David Hedlund
  • 182315 View
  • 228 Score
  • 14 Answer
  • Tags:   mime fonts

1 Answered Questions

[SOLVED] Proper MIME media type for JNLP files

0 Answered Questions

Proper MIME media type for TAR files

6 Answered Questions

[SOLVED] File extensions and MIME Types in .NET

Sponsored Content