Compila un PDF Modulo
PDF4me Compila un modulo PDF popola i campi AcroForm in un PDF modello con valori da un JSON oggetto in un singolo REST chiamata. Invia il modello come Base64 o un pubblico URL, inviare i valori del campo come stringa array di datie ricevere il compilato PDF come byte binari (200) o tramite un polling dell'intestazione Location URL (202). Attiva/disattiva KeepPdfEditable per fornire un modulo modificabile o un record statico non strutturato.
Autenticazione del tuo API Richiesta
Ogni PDF4me REST la chiamata deve includere il tuo API chiave nel Authorization Intestazione come autenticazione di base. Ottieni o ruota la tua chiave dalla dashboard dello sviluppatore.
Punto finale
/api/v2/FillPdfFormhttps://api.pdf4me.com/api/v2/FillPdfFormInformazioni importanti da non perdere
array di dati è una STRINGA, non un oggettoJSON.stringify({...}) prima di pubblicare. L'invio di un oggetto annidato restituisce un errore di deserializzazione.IsAsync: true IL API potrebbe rispondere con 202 e un'intestazione Location. GET Quello URL (stessa autorizzazione) finché non restituisce 200 con il PDF binario. Standard PDF4me modello asincrono (pdf4meAsyncRequest).HTTP impostare
Metodo: INVIARE
URL: https://api.pdf4me.com/api/v2/FillPdfForm
Tipo di contenuto: applicazione/json
Autorizzazione: Base <il tuo PDF4me API chiave>
Inviare IsAsync: true nel corpo. 200 restituisce il riempito PDF come byte binari. 202 restituisce un Posizione intestazione con un sondaggio URL; GET Quello URL con la stessa intestazione di autorizzazione finché non restituisce 200 con il PDF binario (stessa convenzione di pdf4meAsyncRequest).
Matrice variante (rilevante per Postman)
Tre varianti di input coprono ogni chiamata Postman / curl / SDK. Scegli la variante che corrisponde a dove si trova il tuo PDF Dati del modello e del modulo in tempo reale.
| Variante | modello PDF (templateDocContent) | Campi modulo | Campi API obbligatori |
|---|---|---|---|
| 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 campi corporei
Sempre inviato
| Parametro | Necessario | Cosa fa | Esempio |
|---|---|---|---|
| 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 deve essere sempre specificato nella richiesta; scegli un nome file appropriato in modo che i nomi dei file di output siano puliti a valle.
Esempi di carichi utili
Variante A. PDF Base64 + modulo JSON
{
"templateDocName": "application-form.pdf",
"templateDocContent": "JVBERi0xLjQKJcfsj6IKNSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZw...",
"inputDataType": "json",
"outputType": "pdf",
"KeepPdfEditable": false,
"IsAsync": true
}
array di dati deve essere una stringa, non un elemento annidato JSON oggetto:
"dataArray": "{"firstname":"John","lastname":"Doe"}"
Variante B. URL PDF + modulo JSON
{
"templateDocName": "application-form.pdf",
"templateDocContent": "https://example.com/forms/application-form.pdf",
"inputDataType": "json",
"outputType": "pdf",
"KeepPdfEditable": false,
"IsAsync": true
}
Variante C. PDF Base64 + modulo da base64 JSON
Segnaposto nel repository: eyJmaXJzdG5hbWUiOiJKb2huIn0= → {"firstname":"John"}.
Equivalent API corpo dopo aver decodificato il modulo JSON:
{
"templateDocName": "application-form.pdf",
"templateDocContent": "JVBERi0xLjQKJcfsj6IKNSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZw...",
"dataArray": "{\"firstname\": \"John\"}",
"inputDataType": "json",
"outputType": "pdf",
"KeepPdfEditable": false,
"IsAsync": true
}
Opzionale. Mantieni il modulo modificabile
{
"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
}
Consigli per la raccolta del postino
esempio di riccio
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
Riferimento rapido: obbligatorio vs facoltativo (Postino)
| Campo | A (PDF b64) | B (URL del PDF) | C (formato 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 |