Skip to main content

Installation

Use @markpdf/nextjs for Next.js App Router projects. It keeps MARKPDF_API_KEY on the server and gives you Route Handler and Server Action helpers.

Install

Configure the API key

Create or update .env.local:
Do not prefix it with NEXT_PUBLIC_.

Minimal route handler

app/api/convert/route.ts
Your client component can upload a FormData file to /api/convert; the API key never reaches the browser.

API endpoint

The production API endpoint is:

Next step

Continue with Quickstart.