PDFkind
Developer docs: How it works

Upload helper

Upload helper

Stop “file too big” errors: PDFs, photos and iPhone HEIC images are reduced in the visitor’s browser and handed to your form, which receives a file that fits.

Where to put the limit

Add data-pdfkind-max where files come in. The closest element with the attribute wins, so one field can have its own limit inside a form that has another.

Your uploadPut data-pdfkind-max onExample
A file fieldthe input<input type="file" data-pdfkind-max="5MB">
A drag-and-drop areathe area (covers dropping and its “browse” button)<div class="dropzone" data-pdfkind-max="5MB">
A whole formthe form<form data-pdfkind-max="5MB">
Every field on the pagethe script tag, as data-max<script src="…/embed.js" data-max="5MB" defer>

Writing the limit

Write it like 5MB, 500KB, 2.5 MB or 800ko, or as a number of bytes such as 5000000. 1 MB is 1,000,000 bytes.

Good to know. If your server checks 5 × 1,024 × 1,024 bytes, still write 5MB: it’s slightly lower, so reduced files always pass your check.

What happens to each file

FileWhat the helper does
Under the limitNothing. It goes straight to your form, no window opens.
PDF over the limitReduced: fonts and duplicate data are slimmed first, then images are lightened only as much as needed. Text stays sharp and selectable.
JPG, PNG, WebP over the limitRe-encoded and resized only as much as needed. A PNG without transparency that can’t fit becomes a JPG.
HEIC or HEIF (iPhone photos)Always turned into JPG, even under the limit, since most forms don’t accept HEIC.
Any other file (Word, ZIP…)Left untouched.
Several files at onceEach one is handled in turn; your field receives all of them.

What the visitor sees

A small PDFkind window opens over your page with “Reducing your file…”, then shows the result (“Reduced from 8.2 MB to 3.9 MB”) and closes by itself. Most files take 1 to 5 seconds; a long scan on an older phone can take about 15.

IfThen
the file can’t get under the limitThe window explains why, then the original file goes through so your form shows its usual error.
the visitor closes the windowThe original file goes through.
the window can’t load within 8 secondsThe original file goes through at once (offline, or blocked by your security rules).
the script itself can’t loadNothing changes on your page: your form works as before.

Language of the window

The window follows your page’s <html lang>. Set data-lang="fr" on the field or the script to choose. See Languages.

Frameworks

Last updated November 3, 2026 · Questions: contact@pdfkind.com