Skip to Content
NexPDF

Optimize and linearize

Make PDFs smaller and quicker to open on the web.

English

The optimize action makes the file smaller by removing what it does not need and compressing the rest. Setting linearize on the PDF output arranges the file so a browser can show the first page before the rest has downloaded.

Cost: 1 unit per action.

Prepare a brochure for the web

curl https://api.nexpdf.dev/v1/build \
  -H "Authorization: Bearer $NEXPDF_API_KEY" \
  -F doc=@brochure.pdf \
  -F 'instructions={
    "parts": [
      {
        "file": "doc"
      }
    ],
    "actions": [
      {
        "type": "optimize"
      }
    ],
    "output": {
      "type": "pdf",
      "linearize": true
    }
  }' \
  -o brochure-web.pdf

On this page