Заполните PDF Форма
PDF4me Заполните PDF-форму заполняет поля AcroForm в PDF шаблон со значениями из JSON объект в одном REST позвонить. Отправить шаблон как Base64 или общественный URLотправляйте значения полей в строковом формате. массив данныхи получить заполненный PDF в двоичных байтах (200) или через опрос заголовка Location. URL (202). Переключить KeepPdfEditable предоставить редактируемую форму или плоскую статическую запись.
Аутентификация вашего API Запрос
Каждый PDF4me REST В звонке необходимо указать ваш API ключ в Authorization В заголовке используется базовая аутентификация. Получите или измените свой ключ на панели разработчика.
Конечная точка
/api/v2/FillPdfFormhttps://api.pdf4me.com/api/v2/FillPdfFormВажные факты, которые нельзя пропустить
массив данных Это строка, а не объект.JSON.stringify({...}) Перед отправкой. Отправка вложенного объекта приводит к ошибке десериализации.IsAsync: true тот API может ответить кодом 202 и заголовком Location. GET что URL (та же авторизация) до тех пор, пока не будет возвращен код 200 с PDF двоичный. Стандартный PDF4me асинхронный шаблон (pdf4meAsyncRequest).HTTP настраивать
Метод: ПОЧТА
URL: https://api.pdf4me.com/api/v2/FillPdfForm
Content-Type: приложение/json
Авторизация: Базовый <ваш PDF4me API ключ>
Отправлять IsAsync: true в организме. 200 возвращает заполненный PDF в виде двоичных байтов. 202 возвращает Расположение заголовок с опросом URL; GET что URL с тем же заголовком Authorization до тех пор, пока не будет возвращен код 200. PDF двоичный (та же система обозначений, что и) pdf4meAsyncRequest).
Матрица вариантов (применимо к Postman)
Для каждого вызова Postman / curl / SDK доступны три варианта ввода. Выберите вариант, соответствующий вашему запросу. PDF Данные шаблонов и форм отображаются в режиме реального времени.
| Вариант | PDF-шаблон (templateDocContent) | Поля формы | Обязательные поля API |
|---|---|---|---|
| A | Base64 PDF | JSON object → stringify → dataArray | All rows in the JSON-form table below. |
| B | Public PDF URL | JSON object → stringify → dataArray | Same as A; templateDocContent is the URL string. |
| C | Base64 PDF | Base64-encoded JSON file → decode → stringify into dataArray | Same as A; build dataArray from the decoded JSON. |
API поля тела
Всегда отправляется
| Параметр | Необходимый | Что это делает | Пример |
|---|---|---|---|
| jobIdExt | Optional | Your own reference for this call. It is stored with the API call log so you can correlate calls with your jobs. Type: string. | |
| integrations | Optional | Integration identifiers, forwarded unchanged with the job's notification settings. Type: array. | |
| isAsync | Optional | Set to `true` to process the action asynchronously and get a job to poll at `/api/v2/GetActionStatus`. Only honoured by actions that support asynchronous processing. Type: boolean. | Default true. Toggles the 200 / 202 + Location async pattern. |
| templateDocName | Optional | File name of the PDF form, e.g. `form.pdf`. Defaults to `fillpdfform.pdf`; the extension is always set to `.pdf`. Type: string. | Filename of the template, e.g. template.pdf. Derived from the source URL filename or defaulted to template.pdf. Used for downstream output naming. |
| templateDocContent | Optional | Required. The PDF form to fill. Accepts the base64-encoded file content, a `pdf4meblobid://<id>` reference, or an `https` URL. Type: string. | Base64-encoded PDF (no data: prefix) OR a publicly reachable https URL to the PDF. |
| dataArray | Optional | Form data as a JSON string, e.g. `{"name":"John"}`. Used when `InputFormData` is empty. Type: string. | JSON.stringify({ ... }). Keys = AcroForm field names; values = strings to fill. |
| outputType | Optional | Not used by this endpoint; the value is ignored. Type: string. | Always "pdf". |
| inputDataType | Optional | Not used by this endpoint; the value is ignored. Type: string. | Always "json" for this path. |
| metaData | Optional | Not used by this endpoint; the value is ignored. Type: string. | |
| metaDataJson | Optional | Not used by this endpoint; the value is ignored. Type: string. | |
| InputFormData | Optional | Form field values as a list of name/value pairs. Takes precedence over `dataArray`. Type: array. | |
| keepPdfEditable | Optional | Keep the form fields editable in the filled PDF. Type: boolean. | Default false. Set true to keep AcroForm fields editable in the output PDF; false flattens the form into static text. |
*templateDocName Этот параметр всегда должен быть указан в запросе; выберите подходящее имя файла, чтобы имена выходных файлов были корректными при дальнейшей обработке.
Примеры полезных нагрузок
Вариант А. PDF Base64 + формат JSON
{
"templateDocName": "application-form.pdf",
"templateDocContent": "JVBERi0xLjQKJcfsj6IKNSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZw...",
"inputDataType": "json",
"outputType": "pdf",
"KeepPdfEditable": false,
"IsAsync": true
}
массив данных Это должна быть строка, а не вложенный элемент. JSON объект:
"dataArray": "{"firstname":"John","lastname":"Doe"}"
Вариант B. URL PDF + JSON-форма
{
"templateDocName": "application-form.pdf",
"templateDocContent": "https://example.com/forms/application-form.pdf",
"inputDataType": "json",
"outputType": "pdf",
"KeepPdfEditable": false,
"IsAsync": true
}
Вариант C. PDF Base64 + форма из base64 JSON
Заполнитель в репозитории: eyJmaXJzdG5hbWUiOiJKb2huIn0= → {"firstname":"John"}.
Эквивалент API тело после расшифровки формы JSON:
{
"templateDocName": "application-form.pdf",
"templateDocContent": "JVBERi0xLjQKJcfsj6IKNSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZw...",
"dataArray": "{\"firstname\": \"John\"}",
"inputDataType": "json",
"outputType": "pdf",
"KeepPdfEditable": false,
"IsAsync": true
}
Необязательно. Форма должна оставаться редактируемой.
{
"templateDocName": "application-form.pdf",
"templateDocContent": "https://example.com/forms/application-form.pdf",
"dataArray": "{\"firstname\": \"John\", \"lastname\": \"Doe\"}",
"inputDataType": "json",
"outputType": "pdf",
"KeepPdfEditable": true,
"IsAsync": true
}
Советы по сбору почты
пример curl
curl -X POST https://api.pdf4me.com/api/v2/FillPdfForm \
-H "Content-Type: application/json" \
-H "Authorization: Basic YOUR_API_KEY" \
-d '{
"templateDocName": "application-form.pdf",
"templateDocContent": "https://example.com/forms/application-form.pdf",
"dataArray": "{\"firstname\":\"John\",\"lastname\":\"Doe\"}",
"inputDataType": "json",
"outputType": "pdf",
"KeepPdfEditable": false,
"IsAsync": true
}' \
--output filled-form.pdf
Краткий справочник: обязательные и необязательные (Postman)
| Поле | А (PDF b64) | B (Ссылка на PDF-файл) | C (форма b64 → JSON) |
|---|---|---|---|
templateDocName | Required | Required | Required |
templateDocContent | Required (b64) | Required (URL) | Required (b64) |
dataArray | Required | Required | Required (from decoded JSON) |
inputDataType | Required (json) | Required (json) | Required (json) |
outputType | Required (pdf) | Required (pdf) | Required (pdf) |
IsAsync | Required (true) | Required (true) | Required (true) |
KeepPdfEditable | Optional | Optional | Optional |