Перейти к основному содержимому

Заполните PDF Форма

Что делает эта конечная точка

PDF4me Заполните PDF-форму заполняет поля AcroForm в PDF шаблон со значениями из JSON объект в одном REST позвонить. Отправить шаблон как Base64 или общественный URLотправляйте значения полей в строковом формате. массив данныхи получить заполненный PDF в двоичных байтах (200) или через опрос заголовка Location. URL (202). Переключить KeepPdfEditable предоставить редактируемую форму или плоскую статическую запись.

Похожие записи в блоге
Пока нет публикации в блоге, посвященной этой функции — она скоро появится.
А пока что, загляните в блог PDF4me, где вы найдете обучающие материалы и рабочие процессы для всех платформ.
Посетите блог →

Аутентификация вашего API Запрос​

Каждый PDF4me REST В звонке необходимо указать ваш API ключ в Authorization В заголовке используется базовая аутентификация. Получите или измените свой ключ на панели разработчика.

Конечная точка​

ПОЧТА/api/v2/FillPdfForm

Важные факты, которые нельзя пропустить​

массив данных Это строка, а не объект.
Он API ожидает строковый формат JSONВсегда заключайте данные вашей формы в обертку. JSON.stringify({...}) Перед отправкой. Отправка вложенного объекта приводит к ошибке десериализации.
Ключи должны точно соответствовать именам полей AcroForm.
Названия полей чувствительны к регистру. Проверьте шаблон с помощью Adobe Acrobat. Подготовить форму или сначала вызовите конечную точку «Извлечение данных из формы», чтобы получить чистый список всех полей, которые можно заполнить.
Асинхронный процесс возвращает 202 + заголовок Location
С 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
ABase64 PDFJSON object → stringify → dataArrayAll rows in the JSON-form table below.
BPublic PDF URLJSON object → stringify → dataArraySame as A; templateDocContent is the URL string.
CBase64 PDFBase64-encoded JSON file → decode → stringify into dataArraySame as A; build dataArray from the decoded JSON.

API поля тела​

Всегда отправляется​

ПараметрНеобходимыйЧто это делаетПример
jobIdExtOptionalYour own reference for this call. It is stored with the API call log so you can correlate calls with your jobs. Type: string.
integrationsOptionalIntegration identifiers, forwarded unchanged with the job's notification settings. Type: array.
isAsyncOptionalSet 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.
templateDocNameOptionalFile 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.
templateDocContentOptionalRequired. 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.
dataArrayOptionalForm 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.
outputTypeOptionalNot used by this endpoint; the value is ignored. Type: string.Always "pdf".
inputDataTypeOptionalNot used by this endpoint; the value is ignored. Type: string.Always "json" for this path.
metaDataOptionalNot used by this endpoint; the value is ignored. Type: string.
metaDataJsonOptionalNot used by this endpoint; the value is ignored. Type: string.
InputFormDataOptionalForm field values as a list of name/value pairs. Takes precedence over `dataArray`. Type: array.
keepPdfEditableOptionalKeep 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...",
"dataArray": "{\"firstname\": \"John\", \"lastname\": \"Doe\", \"email\": \"[email protected]\"}",
"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",
"dataArray": "{\"firstname\": \"John\", \"lastname\": \"Doe\", \"email\": \"[email protected]\"}",
"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
}

Советы по сбору почты​

Headers
Content-Type: application/json + Authorization: Basic <apiKey>.
Body
raw JSON. Copy one of the variant payloads above.
Response
Save as .pdf when status is 200 and the body is binary. If 202, GET the Location URL with the same Authorization until 200.
Field names
Must exactly match AcroForm names in the template. Use the Extract Form Data endpoint or a PDF editor if you are unsure.

пример 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)
templateDocNameRequiredRequiredRequired
templateDocContentRequired (b64)Required (URL)Required (b64)
dataArrayRequiredRequiredRequired (from decoded JSON)
inputDataTypeRequired (json)Required (json)Required (json)
outputTypeRequired (pdf)Required (pdf)Required (pdf)
IsAsyncRequired (true)Required (true)Required (true)
KeepPdfEditableOptionalOptionalOptional

Примеры кода​

Часто задаваемые вопросы​

Why must dataArray be a stringified JSON, not a nested object?+
The API contract defines dataArray as a string field. The engine parses the string server-side. Sending a nested object returns a deserialization error. Always wrap your form values with JSON.stringify before posting.
What happens when KeepPdfEditable is true?+
The output PDF retains its AcroForm field definitions so the recipient can re-edit values in any PDF viewer. KeepPdfEditable false (the default) flattens the form into static text, useful for delivering a locked record of what was submitted.
How do I know the exact AcroForm field names?+
Open the template in Adobe Acrobat (Prepare Form), use any PDF editor with field inspection, or call the PDF4me Extract Form Data endpoint first. Keys in your dataArray JSON must match those names exactly, including case.
When should I use Variant B (PDF URL) over Variant A (Base64)?+
Use Variant B when the template is already hosted at a publicly reachable HTTPS URL. It avoids the Base64 size bloat (~33%) and is the simplest path for templates pinned in S3, CDN, or your own static asset host. Use Variant A when the template is private or local.
How does the async flow work?+
Send IsAsync true. If the API returns 200, the PDF binary is in the body. If it returns 202, read the Location response header for a poll URL. GET that URL with the same Authorization header. Continue polling (commonly 10s intervals up to 15 retries) until it returns 200 with the PDF.
Can I send an array of multiple form-data objects?+
No. The REST contract requires a single object inside dataArray (after JSON.stringify). To fill many forms, call the endpoint once per form.
My PDF Base64 has a data: prefix. Do I strip it?+
Yes. The API expects raw Base64 in templateDocContent. Strip any data:application/pdf;base64, prefix before posting.
How do I get back something other than PDF?+
You cannot. outputType is fixed to pdf for this endpoint. To rasterize the filled PDF into PNG / JPEG, chain a downstream PDF4me Convert PDF to Image call.

Связанные действия​

Извлечение данных из формы
Вспомогательная конечная точка. Извлекает имена полей и текущие значения из любой формы AcroForm. PDF перед разработкой полезной нагрузки для массива данных.
Подпишите PDF
Типичный последовательный этап: заполнить форму, затем подписать ее цифровой подписью перед отправкой.
Защитить документ
После заполнения форм установите парольную защиту и права доступа. Это полезно при отправке заполненных форм по электронной почте.

Аналогичная задача на других платформах.​

Заполните PDF-форму в Make
Визуальные сценарии с модулями облачного хранилища, подключенными к одним и тем же именам полей dataArray и AcroForm.
Заполните PDF-форму в Zapier
Запускайте заполнение форм из любого из более чем 6000 SaaS-приложений и веб-хуков.
Заполните PDF-форму в Power Automate
Microsoft 365 потоки с SharePoint, OutlookИнтеграция с Teams и Dataverse.
Заполните PDF-форму в n8n
Самостоятельное размещение или облачное решение n8n рабочие процессы с одинаковым Base64 / URL / Двоичные режимы ввода.

Получить помощь​