Ana içeriğe geç

Doldurun PDF Biçim

Bu uç noktanın işlevi

PDF4me PDF Formunu Doldurun AcroForm alanlarını doldurur. PDF değerleri içeren bir şablon JSON tek bir nesnede REST Çağrı. Şablonu şu şekilde gönderin: Base64 veya halka açık URLAlan değerlerini stringleştirilmiş olarak gönderin. veri dizisive doldurulmuş olanı teslim alın. PDF ikili baytlar (200) olarak veya bir Konum başlığı sorgulaması yoluyla URL (202). Geçiş KeepPdfEditable Yeniden düzenlenebilir bir form veya düzleştirilmiş statik bir kayıt sunmak.

İlgili Blog Yazıları
Bu özellik için henüz bir blog yazısı yok — yakında yayınlanacak.
Bu arada, her platforma yönelik eğitimler ve iş akışları için PDF4me bloguna göz atın.
Blogu ziyaret edin

Kimliğinizi Doğrulama API Rica etmek

Her PDF4me REST Çağrınızda mutlaka sizin de bulunmanız gerekiyor. API anahtara Authorization Başlıkta Temel kimlik doğrulama (Basic auth) belirtilmiştir. Anahtarınızı geliştirici kontrol panelinden alın veya değiştirin.

Uç nokta

POSTALAMAK/api/v2/FillPdfForm

Kaçırmamanız Gereken Önemli Bilgiler

veri dizisi Bu bir nesne değil, bir dizedir.
O API sıkılaştırılmış bir şey bekliyor JSONForm verilerinizi her zaman şu şekilde sarmalayın: JSON.stringify({...}) Göndermeden önce. İç içe geçmiş bir nesne göndermek, seri hale getirme hatasına neden olur.
Anahtarlar, AcroForm alan adlarıyla birebir eşleşmelidir.
Alan adları büyük/küçük harf duyarlıdır. Şablonu Adobe Acrobat ile inceleyin. Formu Hazırlayın Ya da öncelikle Form Verilerini Çıkarma uç noktasına çağrı yaparak doldurulabilir her alanın temiz bir listesini alabilirsiniz.
Async 202 + Location başlığı döndürüyor
İle IsAsync: true o API 202 yanıtı ve bir Location başlığı içerebilir. GET O URL (aynı yetkilendirme) 200 yanıtı verene kadar PDF ikili. Standart PDF4me asenkron desen (pdf4meAsyncRequest).

HTTP kurmak

Yöntem: POSTALAMAK
URL: https://api.pdf4me.com/api/v2/FillPdfForm
İçerik Türü: uygulama/json
Yetkilendirme: Temel <sizin PDF4me API anahtar>

Göndermek IsAsync: true Vücutta. 200 doldurulmuş olanı geri gönderir. PDF ikili baytlar olarak. 202 bir döndürür Konum anket içeren başlık URL; GET O URL Aynı Yetkilendirme başlığıyla, 200 yanıtı verene kadar devam eder. PDF ikili (aynı kurala göre) pdf4meAsyncRequest).

Varyant matrisi (Postman ile ilgili)

Üç giriş varyantı, her Postman / curl / SDK çağrısını kapsar. İhtiyaçlarınıza uygun olan varyantı seçin. PDF Şablon ve form verileri canlı olarak görüntülenir.

VaryantPDF şablonu (şablonBelgeİçeriği)Form alanlarıGerekli API alanları
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 vücut alanları

Her zaman gönderildi

AlanGerekliTipVarsayılan / notlar
templateDocNameYes*stringFilename of the template, e.g. template.pdf. Derived from the source URL filename or defaulted to template.pdf. Used for downstream output naming.
templateDocContentYesstringBase64-encoded PDF (no data: prefix) OR a publicly reachable https URL to the PDF.
KeepPdfEditableNobooleanDefault false. Set true to keep AcroForm fields editable in the output PDF; false flattens the form into static text.
IsAsyncYesbooleanDefault true. Toggles the 200 / 202 + Location async pattern.

*şablonBelgeAdı İstekte her zaman belirtilmelidir; çıktı dosya adlarının daha sonraki aşamalarda temiz olması için mantıklı bir dosya adı seçin.

Form girişi yapıldığında JSON

AlanGerekliTipNotlar
dataArrayYesstringJSON.stringify({ ... }). Keys = AcroForm field names; values = strings to fill.
inputDataTypeYesstringAlways "json" for this path.
outputTypeYesstringAlways "pdf".

Form veri kuralları (JSON yol)

KuralDetay
ShapeSingle object: {"fieldName": "value", ...}.
Not allowedEmpty array, or an array of multiple objects.
Base64 form inputDecode the UTF-8 JSON file, then JSON.stringify into dataArray. In Postman: put the decoded-then-stringified result directly into dataArray.
Data URLStrip the data:...;base64, prefix if present (applies to the PDF Base64 in templateDocContent).

Örnek yükler

Varyant A. PDF Base64 + form JSON

{
"templateDocName": "application-form.pdf",
"templateDocContent": "JVBERi0xLjQKJcfsj6IKNSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZw...",
"dataArray": "{\"firstname\": \"John\", \"lastname\": \"Doe\", \"email\": \"[email protected]\"}",
"inputDataType": "json",
"outputType": "pdf",
"KeepPdfEditable": false,
"IsAsync": true
}

veri dizisi Bir dize olmalı, iç içe geçmiş bir yapı olmamalı. JSON nesne:
"dataArray": "{"firstname":"John","lastname":"Doe"}"

Varyant B. PDF URL'si + form JSON'u

{
"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
}

Varyant C. PDF Base64 + Base64 JSON'dan form

Depodaki yer tutucu: eyJmaXJzdG5hbWUiOiJKb2huIn0={"firstname":"John"}.

Eş değer API vücut formu çözdükten sonra JSON:

{
"templateDocName": "application-form.pdf",
"templateDocContent": "JVBERi0xLjQKJcfsj6IKNSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZw...",
"dataArray": "{\"firstname\": \"John\"}",
"inputDataType": "json",
"outputType": "pdf",
"KeepPdfEditable": false,
"IsAsync": true
}

İsteğe bağlı. Formu düzenlenebilir tutun.

{
"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
}

Postacı tahsilat ipuçları

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 örneği

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

Hızlı referans: Gerekli ve isteğe bağlı (Postacı)

AlanA (PDF b64)B (PDF URL)C (b64 biçiminde → 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

Kod örnekleri

SSS

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.

İlgili işlemler

Diğer platformlarda aynı görev

Yardım Alın