Ana içeriğe geç

Belge Oluştur (Birden Fazla)

Bu uç noktanın işlevi

PDF4me Belge Oluştur (Birden Fazla) birden fazla belgeyi tek bir şekilde görüntüler REST Çağrı. Tek bir kelime gönder. HTML, veya PDF şablon (Base64, URLveya ham HTML) artı bir dizi kayıt (JSON veya XMLmetin olarak, Base64 dosya veya URL). Bir değer döndürür. JSON Oluşturulan dosyaların listesi (her kayıt için bir giriş) Base64 içinde çıktıBelgeleri[].akışDosyasıYanıta bağlı olarak ya da tek bir ikili değer.

İ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 girin 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/GenerateDocumentMultiple

Uç nokta adı şudur: GenerateDocumentMultiple (tekil) Belge), Olumsuz GenerateDocumentsMultiple.

Kaçırmamanız Gereken Önemli Bilgiler

Tek şablon, birçok kayıt
Bir mesaj gönderin. JSON dizi (veya tekrarlanan kayıt) XMLVeri yükünüzdeki her bir dizi öğesi için bir çıktı belgesi oluşturulur ve bunlar birlikte döndürülür. Motor, her dizi öğesi için bir çıktı belgesi oluşturur ve bunları birlikte döndürür.
Yanıt genellikle JSON çıktıBelgeleri[]
Her girişin bir dosya adı ve bir base64 akış dosyası (Bazen dosya içeriği, içerik, veya veriHer bir base64 dizesini çözerek dosyayı kaydedin.
Tek seçenekten farklı olarak: CSV ve XLSX dosyalarına izin verilmez, daha az şablon türü sunar.
Şablon türleri şunlarla sınırlıdır: Docx, HTML, PDFSınırlı veri türleri şunlardır: Json, XMLÇıktı ekler xlsx Word için / PDF şablonlar.

HTTP kurmak

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

Göndermek IsAsync: true Vücutta. 200 geri dönebilir JSON ile çıktıBelgeleri[] veya tek bir ikili dosya. 202 bir döndürür Konum anket içeren başlık URL.

Farklılıklar ve Belge Oluşturma (Tekli)

BaşlıkÇokluBekar
Endpoint/api/v2/GenerateDocumentMultiple/api/v2/GenerateDocumentSingle
templateFileTypeDocx, HTML, PDF onlyAlso MailMerge, GoogleDocs
documentDataTypeJson, XML onlyAlso Csv
outputTypePDF, Docx, xlsx (Word/PDF), HTMLNo xlsx
Data shapeTypically array of records (one doc per row)Usually one object
outputFileNameIntegration-UI only (output naming)Not in API body either

Varyant matrisi (Postman ile ilgili)

Şablon (templateFileData)

KodKaynakPostacı değeriAyrıca gerekli
T1Base64Base64 template (strip data:...;base64, prefix if present)templateFileName
T2URLHTTPS URL stringtemplateFileName
T3HTML codeBase64(UTF-8 HTML): Buffer.from(html, "utf8").toString("base64")templateFileName, templateFileType: HTML

Belge verileri

KodKaynakAPI alanıPostacı değeri
D1TextdocumentDataTextJSON array (or XML with multiple records)
D2Base64documentDataFileBase64 of the .json / .xml file
D3URLdocumentDataFileURL to the data file

İkisinden birini kullanın. belgeVeriMetni veya belgeVeriDosyası (Kullanılmayan alanı atlayın).

şablonDosyaTipi → izin verilen çıktıTipi

şablonDosyaTürüİzin verilmiş çıktıTürü
DocxPDF, Docx, xlsx
PDFPDF, Docx, xlsx
HTMLHTML only

API vücut alanları

Her zaman gönderildi

AlanGerekliTipNotlar
templateFileTypeYesstringDocx, HTML, PDF
templateFileNameYesstringe.g. template.docx, template.html, template.pdf
templateFileDataYesstringBase64 template, or template URL
documentDataTypeYesstringJson or XML (exact casing)
outputTypeYesstringPDF, Docx, xlsx, or HTML
IsAsyncYesbooleantrue

Belge verileri (tek yol)

AlanGerekli olduğu zamanlarTipNotlar
documentDataTextD1stringValid JSON (JSON.parse) or XML-like for XML
documentDataFileD2 or D3stringBase64 data file or URL

İsteğe bağlı

AlanNe zamanVarsayılan
KeepPdfEditableoutputType is PDFfalse

Doğrulama kuralları

Kontrol etmekDetay
Template URL / base64Same rules as Single.
HTML codeOnly when templateFileType is HTML.
JSON textMust parse with JSON.parse.
XML textLooser than Single (no strict tag check); send XML the template expects.
Data sourcedocumentDataFile or documentDataText is required.

Çoklu kayıt veri şekli

İçin JSONNesne dizisi kullanın (oluşturulan her belge için bir nesne):

[
{ "name": "Alice", "email": "[email protected]" },
{ "name": "Bob", "email": "[email protected]" }
]

İçin XMLTekrarlanan satırlar için şablonunuzun beklediği bir yapı kullanın (posta birleştirme ile aynı mantık). API sadece şunu kontrol eder JSON Ayrıştırma işlemleri; motor, kaç belge üretileceğini belirler.

API yanıt (Postacı)

Genellikle JSON formatında şu şekildedir:

{
"outputDocuments": [
{
"fileName": "document1.pdf",
"streamFile": "<base64>"
}
]
}

Alan adı şu şekilde de görünebilir: fileContent, content, veya dataHer birini çözün. Base64 Her dosyayı kaydetmek için kullanılan dize.

Örnek yükler

1. Word şablonu (base64) + JSON dizi (metin) → çoklu PDFs

{
"templateFileType": "Docx",
"templateFileName": "template.docx",
"templateFileData": "UEsDBBQAAAAI...",
"documentDataType": "Json",
"documentDataText": "[{\"name\": \"Alice\", \"email\": \"[email protected]\"}, {\"name\": \"Bob\", \"email\": \"[email protected]\"}]",
"outputType": "PDF",
"KeepPdfEditable": false,
"IsAsync": true
}

2. Word şablonu (URL) + JSON veri (URL) → PDFs

{
"templateFileType": "Docx",
"templateFileName": "template.docx",
"templateFileData": "https://example.com/template.docx",
"documentDataType": "Json",
"documentDataFile": "https://example.com/customers.json",
"outputType": "PDF",
"IsAsync": true
}

3. Word şablonu (base64) + JSON dosya (base64) → Excel (xlsx)

{
"templateFileType": "Docx",
"templateFileName": "template.docx",
"templateFileData": "UEsDBBQAAAAI...",
"documentDataType": "Json",
"documentDataFile": "W3sibmFtZSI6ICJBbGljZSJ9LCB7Im5hbWUiOiAiQm9iIn1d",
"outputType": "xlsx",
"IsAsync": true
}

(documentDataFile = base64'ü [{"name":"Alice"},{"name":"Bob"}].)

4. HTML şablon (base64) + JSON dizi (metin) → HTML

{
"templateFileType": "HTML",
"templateFileName": "template.html",
"templateFileData": "PCFET0NUWVBFIGh0bWw+...",
"documentDataType": "Json",
"documentDataText": "[{\"title\": \"Invoice 1\", \"heading\": \"Hello\", \"content\": \"A\"}, {\"title\": \"Invoice 2\", \"heading\": \"Hi\", \"content\": \"B\"}]",
"outputType": "HTML",
"IsAsync": true
}

5. PDF şablon (URL) + XML (metin) → birden fazla PDFs

{
"templateFileType": "PDF",
"templateFileName": "template.pdf",
"templateFileData": "https://example.com/template.pdf",
"documentDataType": "XML",
"documentDataText": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><records><record><name>Alice</name></record><record><name>Bob</name></record></records>",
"outputType": "PDF",
"KeepPdfEditable": true,
"IsAsync": true
}

6. Word şablonu (base64) + XML (URL) → Word (Docx)

{
"templateFileType": "Docx",
"templateFileName": "template.docx",
"templateFileData": "UEsDBBQAAAAI...",
"documentDataType": "XML",
"documentDataFile": "https://example.com/data.xml",
"outputType": "Docx",
"IsAsync": true
}

Postacı tahsilat ipuçları

Array data
Prefer a JSON array in documentDataText when documentDataType is Json and you expect more than one file.
Filename match
Match the extension in templateFileName to templateFileType.
Base64 of file
For D2, base64-encode the whole data file (not each row separately).
Decode response
If the response is JSON, decode each outputDocuments[].streamFile (or fileContent / content / data) from base64.
Endpoint name
Endpoint name is GenerateDocumentMultiple (singular Document), not GenerateDocumentsMultiple.

curl örneği

curl -X POST https://api.pdf4me.com/api/v2/GenerateDocumentMultiple \
-H "Content-Type: application/json" \
-H "Authorization: Basic YOUR_API_KEY" \
-d '{
"templateFileType": "Docx",
"templateFileName": "template.docx",
"templateFileData": "https://example.com/template.docx",
"documentDataType": "Json",
"documentDataText": "[{\"name\":\"Alice\"},{\"name\":\"Bob\"}]",
"outputType": "PDF",
"IsAsync": true
}' \
--output response.json

Hızlı referans: varyanta göre gerekli ve isteğe bağlı olanlar

AlanT1+D1T2+D3T1+D2T3+D1PDF çıktısı
templateFileTypeReqReqReqReqReq
templateFileNameReqReqReqReqReq
templateFileDataReq (b64)Req (URL)Req (b64)Req (b64)Req
documentDataTypeReqReqReqReqReq
outputTypeReqReqReqReqReq
documentDataTextReqOmitOmitReqOmit
documentDataFileOmitReqReqOmitOmit
IsAsyncReqReqReqReqReq
KeepPdfEditableOptOptOptN/A*Opt

*Sadece şu durumlarda çıktıTürü dır PDF.

Kod örnekleri

SSS

How is Multiple different from Single?+
Different endpoint (/api/v2/GenerateDocumentMultiple), fewer template types (Docx, HTML, PDF only), no CSV, can output xlsx, and expects array-shaped data to produce one document per record in a single call.
What does the response look like?+
Typically a JSON object with outputDocuments[], each containing fileName and streamFile (base64). Some responses may use fileContent, content, or data as the field name. Decode each base64 string to save the file.
Which output types are allowed?+
Docx and PDF templates accept PDF, Docx, or xlsx. HTML template accepts HTML only.
Does HTML output produce multiple files?+
Yes when the engine renders one HTML document per input record. The response still uses the outputDocuments[] shape.
What is the maximum array size?+
No published hard cap. Large batches usually push you onto the async path (202 + Location poll). For very large workloads, split into multiple calls of a few hundred records each.
Why is the endpoint name singular Document?+
The path is /api/v2/GenerateDocumentMultiple, not GenerateDocumentsMultiple. A common typo. The plural version returns 404.
Does KeepPdfEditable work for xlsx or HTML output?+
No. It only applies when outputType is PDF. For other outputs the API ignores it.
Can I mix multiple template files in one call?+
No. One call uses one template. To render the same data set against multiple templates, issue one call per template.

İlgili işlemler

Diğer platformlarda aynı görev

Yardım Alın