application/pdf MIME Type — PDF Content-Type & Download Headers
Portable Document Format. A file format for documents with fixed layout — text, images, and vector graphics rendered identically across all devices. Created by Adobe. The standard format for invoices, contracts, reports, and printable documents.
Used For
- Invoices and receipts
- Contracts and legal documents
- Reports and presentations
- eBooks and whitepapers
HTTP Header Example
HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Disposition: attachment; filename="invoice.pdf"
Content-Length: 45231
[binary PDF data]Code Examples
// Express — serve PDF for inline view or download
app.get('/invoice/:id', async (req, res) => {
const pdf = await generateInvoicePdf(req.params.id)
res
.set('Content-Type', 'application/pdf')
.set('Content-Disposition', 'attachment; filename="invoice.pdf"') // force download
// .set('Content-Disposition', 'inline') // display in browser
.send(pdf)
})
// Next.js — return PDF from route handler
export async function GET(request, { params }) {
const pdf = await generatePdf((await params).id)
return new Response(pdf, {
headers: {
'Content-Type': 'application/pdf',
'Content-Disposition': 'attachment; filename="report.pdf"',
},
})
}Related MIME Types
Frequently Asked Questions
What is the application/pdf MIME type?
Portable Document Format. A file format for documents with fixed layout — text, images, and vector graphics rendered identically across all devices. Created by Adobe. The standard format for invoices, contracts, reports, and printable documents.
When should I set Content-Type: application/pdf?
Set Content-Type: application/pdf on HTTP responses that contain PDF data. Invoices and receipts.
What file extensions use application/pdf?
Files with application/pdf content typically use these extensions: .pdf.
What happens if I serve this with the wrong Content-Type?
Browsers use the Content-Type header to decide how to handle the response. Serving application/pdf content with an incorrect MIME type can cause browsers to display it incorrectly, refuse to execute it (scripts), or prompt an unintended download. Modern browsers respect X-Content-Type-Options: nosniff and will not attempt to auto-detect the type.
