Content-Type for PDF Documents

Set the Content-Type header for serving or uploading PDF files. Covers inline display vs download and Content-Disposition options.

File Uploads

Detailed Explanation

PDF Content-Type

PDF files use the application/pdf media type. This is one of the most widely recognized binary Content-Types on the web.

The Header Value

Content-Type: application/pdf

Inline Display vs Download

Control how the browser handles the PDF with Content-Disposition:

Inline (display in browser):

Content-Type: application/pdf
Content-Disposition: inline; filename="invoice.pdf"

Download (force save dialog):

Content-Type: application/pdf
Content-Disposition: attachment; filename="invoice.pdf"

No Charset Needed

PDF is a binary format, so the charset parameter is not applicable and should not be included. The character encoding of text within the PDF is handled internally by the PDF format.

Uploading PDFs

When uploading a PDF as part of a multipart form, the individual part has its own Content-Type:

------FormBoundary
Content-Disposition: form-data; name="document"; filename="contract.pdf"
Content-Type: application/pdf

[PDF binary data]
------FormBoundary--

Content-Length

Always include Content-Length when serving PDFs so clients can show download progress:

Content-Type: application/pdf
Content-Length: 2458190
Content-Disposition: attachment; filename="report.pdf"

curl Example

# Upload a PDF
curl -X POST \
  -H "Content-Type: application/pdf" \
  --data-binary @document.pdf \
  https://api.example.com/documents

Use Case

Use this when building document management systems, invoice generators, report downloaders, or any feature that serves or accepts PDF files. Works with all browsers' built-in PDF viewers.

Try It — Content-Type Header Builder

Open full tool