Media type / application
application/pdf
Portable Document Format. Browsers render it in a built-in viewer, which makes it the one download-shaped format users expect to open in a tab.
Served inline: Browsers display this in the tab without granting it script access to the page. Safe to serve inline, provided the bytes really are what the header claims.
Browser behaviour
Renders inertly
Charset
no charset
Compression
Already compressed
Send it like this
Content-Type: application/pdfA binary payload has no character encoding. A charset parameter here is meaningless and occasionally confuses strict parsers.
Handling verdict
Browsers display this in the tab without granting it script access to the page. Safe to serve inline, provided the bytes really are what the header claims.
A binary payload has no character encoding. A charset parameter here is meaningless and occasionally confuses strict parsers.
The format compresses internally. Another transport encoding costs CPU on both ends and typically changes the size by less than a percent — sometimes upward.
Registered with IANA through a public review process, so the name is stable and every implementation can rely on it meaning the same thing.
Anatomy of the name
RFC 6838Top-level type
application
Application
Subtype
Registered in the standards tree.
Structured syntax
none
No suffix, so the payload format is defined entirely by the subtype itself.
Parameters
none
Beyond the charset rule above, this type defines no parameters of its own.
What trips people up
2 notes- PDFs can embed JavaScript and outbound links, so an inline-rendered upload is a credible phishing surface even though the viewer is sandboxed.
- The container already compresses its streams; another transport encoding usually buys nothing.
Response headers
Content-Type: application/pdf
X-Content-Type-Options: nosniff
Content-Disposition: inlinenosniff stops the browser second-guessing the type you declared, which is what makes the rest of this reliable. Serving it inline is safe here because the browser renders it without granting it script access.
Server configuration
extension mappingnginx
types {
application/pdf pdf;
}Apache
AddType application/pdf .pdfCaddy
@type path *.pdf
header @type Content-Type "application/pdf"Extensions and other spellings
with signatureFile extensions
File signature
25 50 44 46 2D
Check these bytes rather than the client-supplied Content-Type when validating an upload. The header is a claim; the signature is evidence.