Zum Hauptinhalt springen

Konvertieren PDF Zu Excel

PDF4me Konvertieren PDF Zu Excel ist ein REST Endpunkt, der Tabellen und Text aus einem PDF und gibt ein bearbeitbares Objekt zurück Excel Arbeitsbuch. POST A Base64 PDF Zu /api/v2/ConvertPdfToExcelWählen Sie „Entwurf“ oder „Hohe Qualität“ und aktivieren Sie die Option. OCR für gescannt pagesund speichern Sie die zurückgegebenen .xlsx Bytes. Ein Anruf, kein manuelles Abtippen.

Was dieser Endpunkt bewirkt

Sendet eins PDF rein, bekommt eins Excel Die Arbeitsmappe wird exportiert. Die Engine erkennt Tabellenstrukturen auf jeder Seite und baut diese als Tabellenzellen neu auf, wobei der umgebende Text ebenfalls extrahiert wird. qualityType Wechselt zwischen schneller Textebenenextraktion (Entwurf) und seitenweise Erkennung für Scans (Hoch), Und ocrWhenNeeded Läufe OCR Die automatische Funktion wird ausgelöst, wenn eine Seite keine Textebene enthält. Die Antwort ist der Rohdatentext. .xlsx binär (200) oder ein Location Umfrage URL (202).

Verwandte Blog-Beiträge
Zu dieser Funktion gibt es noch keinen Blogbeitrag – folgt in Kürze.
Schauen Sie sich in der Zwischenzeit im PDF4me-Blog Tutorials und Arbeitsabläufe für alle Plattformen an.
Besuchen Sie den Blog

Authentifizierung Ihres API Anfrage

Jeder PDF4me REST Der Anruf muss Ihre API Schlüssel im Authorization Header als Basic Auth. Ihren Schlüssel erhalten oder ändern Sie ihn im Entwickler-Dashboard.

Endpunkt

POST/api/v2/ConvertPdfToExcel

Wichtige Fakten, die Sie nicht verpassen sollten

Draft und High werden unterschiedlich abgerechnet
Entwurfskosten 1 API Aufruf pro Datei und liest die vorhandene Textebene. Hohe Kosten 2 API Es werden pro Seite Aufrufe durchgeführt und jede Seite wird neu verarbeitet, was das Scannen ausmacht. PDFs Funktioniert. Nicht auf sauberen digitalen Systemen mit hoher Leistung laufen lassen. PDFsSie zahlen pro Seite für nichts.
outputFormat Und ocrWhenNeeded sind boolesche Werte
Die offiziellen Codebeispiele senden WAHR / FALSCH JSON Für beide Felder werden boolesche Werte verwendet. Ältere Versionen dieser Seite zeigten Zeichenkettenwerte wie zum Beispiel an. "Ja"; Verwenden Sie boolesche Werte wie in den folgenden Beispielen.
Async Gibt 202 oder mehr zurück Location Überschrift
Mit async: true Die API kann mit 202 antworten Location Kopfzeile. GET Das URL (Dasselbe Authorization) bis es den Statuscode 200 mit der Arbeitsmappen-Binärdatei zurückgibt. Die offiziellen Beispiele fragen alle 10 Sekunden ab, bis zu 10 Wiederholungsversuche.

HTTP aufstellen

Verfahren: POST
URL: https://api.pdf4me.com/api/v2/ConvertPdfToExcel
Inhaltstyp: application/json
Authorization: Basic <Ihre PDF4me API Schlüssel>

Schicken async: true im Körper. 200 gibt das konvertierte Ergebnis zurück .xlsx Arbeitsmappe als Binärbytes. 202 gibt ein zurück Location Überschrift mit einer Umfrage URL; GET Das URL mit dem gleichen Authorization Header bis zur Rückgabe des Statuscodes 200 mit der Arbeitsmappen-Binärdatei.

Welchen Qualitätsmodus soll ich wählen: Entwurf oder Hoch?

Draft liest die Textebene, die bereits in einem digital erstellten Dokument vorhanden ist. PDFDer Modus „Hoch“ rendert und erkennt jede Seite neu, was langsamer und teurer ist, aber der einzige Modus ist, der mit Scans, Fotos von Dokumenten und reinen Bilddateien funktioniert. pagesDie

Draft vs HighEntwurfHoch
Am besten geeignet fürDigital erstellt PDFs mit auswählbarem TextGescannt oder bildbasiert PDFs
Kosten1 API Anruf pro Datei2 API Anrufe pro Seite
OCRNicht angewendetPro Seite angewendet (Paarung mit ocrWhenNeeded: true)
GeschwindigkeitSchnell, ein einziger DurchgangLangsamere, seitenweise Erkennung
Wenn die Tische leer zurückkommenMit hoher Geschwindigkeit erneut versuchenÜberprüfen language wenn der Text verstümmelt ist

API Körperfelder

ParameterErforderlichTypWas es tutBeispiel
docContentRequiredstringBase64-encoded bytes of the source PDF. Strip any data:application/pdf;base64, prefix before posting.JVBERi0xLjcK...
docNameRequiredstringSource filename including the .pdf extension. Used to derive the output filename.invoice-report.pdf
qualityTypeRequiredstringDraft for text-based PDFs (1 API call per file). High for scanned or image-based PDFs (2 API calls per page).Draft
languageConditionalstringLanguage of the text in the source file. Set only when the converted output is not recognizable; otherwise let the engine detect it.English
mergeAllSheetsOptionalbooleantrue combines all extracted content into a single worksheet. false keeps content on separate worksheets.true
outputFormatOptionalbooleanOutput format flag sent as a JSON boolean in the official samples.true
ocrWhenNeededOptionalbooleanRuns OCR automatically on pages without a text layer. Keep true unless you explicitly want recognition skipped.true
asyncOptionalbooleantrue enables the 202 + Location polling pattern, recommended for large or scanned files.true

Beispielnutzlasten

Entwurfsmodus. Digital PDF mit auswählbarem Text

{
"docContent": "JVBERi0xLjcKJcfsj6IKNSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZw...",
"docName": "invoice-report.pdf",
"qualityType": "Draft",
"mergeAllSheets": true,
"outputFormat": true,
"ocrWhenNeeded": true,
"async": true
}

Hoher Modus. gescannt PDF mit OCR

{
"docContent": "JVBERi0xLjcKJcfsj6IKNSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZw...",
"docName": "scanned-statement.pdf",
"qualityType": "High",
"mergeAllSheets": false,
"language": "English",
"outputFormat": true,
"ocrWhenNeeded": true,
"async": true
}

Tipps zur Postboten-Abholung

Headers
Content-Type: application/json + Authorization: Basic <apiKey>.
Body
raw JSON. Copy one of the payloads above and replace docContent with your Base64.
Response
Use Send and Download so Postman saves the binary body as a .xlsx file when status is 200. If 202, GET the Location URL with the same Authorization until 200.
Quality
Start with Draft. Only switch to High when tables come back empty, and expect 2 API calls per page in that mode.

curl-Beispiel

curl -X POST https://api.pdf4me.com/api/v2/ConvertPdfToExcel \
-H "Content-Type: application/json" \
-H "Authorization: Basic YOUR_API_KEY" \
-d '{
"docContent": "'"$(base64 -w 0 invoice-report.pdf)"'",
"docName": "invoice-report.pdf",
"qualityType": "Draft",
"mergeAllSheets": true,
"outputFormat": true,
"ocrWhenNeeded": true,
"async": true
}' \
--output converted.xlsx

Was bedeutet das? API zurückkehren?

Eine erfolgreiche Konvertierung gibt Folgendes zurück: Excel Das Arbeitsbuch selbst, nicht ein JSON Wrapper. Die Ausgabe ist ein moderner Büro geöffnet XML Arbeitsbuch (.xlsx), der Standardwert XML-basiertes Format wird von jeder aktuellen Version unterstützt ExcelBearbeiten Sie die drei folgenden Fälle.

FeldTypWas es enthält
Response body (HTTP 200)BinaryThe converted .xlsx workbook bytes. Write them straight to a file with an .xlsx extension.
Location header (HTTP 202)String (URL)Poll URL for an async job that is still running. GET it with the same Authorization header.
Poll response (HTTP 200)BinaryThe finished workbook, returned once processing completes. The official samples poll every 10 seconds, up to 10 retries.
Poll response (HTTP 202)EmptyJob still processing. Wait and poll the same Location URL again.

Codebeispiele

Funktionierende End-to-End-Implementierungen, jeweils mit einem Beispiel PDF und die genaue Nutzlast von dieser Seite:

Häufig gestellte Fragen

Which quality mode should I choose, Draft or High?+
Draft is for digitally created PDFs with a real text layer and costs 1 API call per file. High is for scanned or image-based PDFs and costs 2 API calls per page. Start with Draft; switch to High only when tables come back empty or garbled.
Can the API extract tables from a scanned PDF?+
Yes. Set qualityType to High and ocrWhenNeeded to true. The engine runs OCR on pages without a text layer and reconstructs detected tables as spreadsheet cells in the output workbook.
What does mergeAllSheets do?+
With mergeAllSheets true the extracted content is combined into a single worksheet. With false, content is kept on separate worksheets, so a multi-page PDF maps to multiple sheets in the workbook.
When do I need the language field?+
Only when the converted output is not recognizable. The engine detects the document language automatically; set language explicitly when recognition returns garbled text for your source language.
Is the response JSON or the file itself?+
The file itself. A 200 response body is the raw .xlsx binary. Do not JSON-parse it; write the bytes to disk. Only the 202 case involves reading a header (Location) instead of the body.
My tables came back as plain text without cell structure. What now?+
Rerun with qualityType High so each page goes through recognition, and keep ocrWhenNeeded true. If the text itself is garbled rather than misplaced, set the language field to match the document.
How large can the PDF be?+
Large and scanned files are exactly what the async pattern is for. Send async true and be prepared to poll the Location URL; the official samples poll every 10 seconds, up to 10 retries, before timing out.
Can I get XLS instead of XLSX?+
No. The endpoint returns a modern Open XML workbook (.xlsx). Legacy .xls output is not offered; every current version of Excel, LibreOffice, and Google Sheets opens .xlsx.

Ähnliche Aktionen

Dieselbe Aufgabe auf anderen Plattformen

Hilfe erhalten