What is MIME type "text/x-pdf"?

A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.

The MIME type text/x-pdf is associated with files in the PDF family. Although modern systems normally use application/pdf for these documents, some legacy setups or specific applications may refer to them with this alternative type.
Its purpose is to classify and handle PDF documents correctly, ensuring that the content is processed for display, print, or further interaction. For more details on the document format, see Wikipedia: PDF.

Associated file extensions

Usage Examples

HTTP Header

When serving content with this MIME type, set the Content-Type header:


    Content-Type: text/x-pdf    
  

HTML

In HTML, you can specify the MIME type in various elements:


    <a href="file.dat" type="text/x-pdf">Download file</a>    
  

Server-side (Node.js)

Setting the Content-Type header in Node.js:


    const http = require('http');    
    
    http.createServer((req, res) => {    
      res.setHeader('Content-Type', 'text/x-pdf');    
      res.end('Content here');    
    }).listen(3000);    
  

Associated file extensions

FAQs

Is text/x-pdf the standard MIME type for PDF files?

No, the standard and officially registered MIME type for PDF documents is application/pdf. The type text/x-pdf is a non-standard or legacy identifier that was used in the past but is now largely obsolete. You should always prefer application/pdf for modern web compatibility.

Why does a PDF file display as random characters or garbage text in my browser?

This usually happens when a server sends the file with the text/x-pdf or text/plain header. Because the browser thinks the file is text, it tries to render the binary PDF code as characters. To fix this, configure the server to send the correct application/pdf Content-Type.

How do I configure Apache to stop using text/x-pdf?

You can force the correct MIME type by editing your .htaccess or httpd.conf file. Add the line AddType application/pdf .pdf to ensure all files with the pdf extension are served correctly, overriding any incorrect text/x-pdf defaults.

What is the difference between text/x-pdf and application/pdf?

The main difference is the top-level media type. text/x-pdf implies the content is human-readable text, which is technically incorrect for binary PDF files. application/pdf correctly identifies the file as a binary format requiring a specific application (like Adobe Reader or a browser's built-in viewer) to render.

Will modern browsers still open a file sent as text/x-pdf?

It depends on the browser's "sniffing" behavior. Chrome and Firefox often detect the file signature (magic numbers) of a PDF and may render it correctly despite the wrong label. However, strictly compliant user agents might treat it as a download or display raw code, so relying on text/x-pdf is risky.

Why would a system use text/x-pdf instead of the standard?

This often occurs in older legacy systems, misconfigured mail servers, or custom scripts written before application/pdf was universally standardized. The x- prefix specifically denotes an experimental or non-standard type, indicating it was a placeholder definition.

General FAQ

What is a MIME type?

A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.

MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.

MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.

How do I find the MIME type for a file?

You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.

Why are multiple MIME types listed for one extension?

Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.