This app does the following:
- Upload a PDF from the browser.
- Convert each PDF page to a separate PNG on the client side.
- Upload each PNG directly from the browser to Vercel Blob.
- Show a page-by-page uploaded URL list.
- Node.js 18+
- A Vercel project with a Blob store
BLOB_READ_WRITE_TOKENfrom that project- A public Vercel Blob store for direct browser uploads
- Install dependencies:
npm install- Create your local env file:
cp .env.example .env- Paste your token into
.env:
BLOB_READ_WRITE_TOKEN=...- Start the app:
npm run dev- Open:
- Browser converts PDF pages to PNG with PDF.js.
- Browser uploads files using
upload()from@vercel/blob/client. - A small server route (
/api/blob/upload) only issues short-lived upload tokens. - File bytes do not pass through your Express server.
For production, add auth/authorization checks in /api/blob/upload before issuing upload tokens.
This implementation uses Vercel Blob client uploads, which currently require access: "public".
If your Blob store is private:
- Direct browser uploads will fail.
- The browser may only show a generic CORS or failed fetch error.
- You must either change the Blob store to public or change the app to upload through your server instead.