Ana içeriğe geç

Dönüştürmek PDF ile Excel

PDF4me Dönüştürmek PDF ile Excel bir REST Tabloları ve metni çıkaran bir uç nokta PDF ve düzenlenebilir bir değer döndürür. Excel çalışma kitabı. POST A Base64 PDF ile /api/v2/ConvertPdfToExcelTaslak veya Yüksek kaliteyi seçin, etkinleştirin OCR taranmış için pagesve iade edilenleri kaydedin. .xlsx Baytlar. Tek bir çağrı, manuel yeniden yazmaya gerek yok.

Bu uç noktanın işlevi

Bir tane gönderiyor PDF içeri girerse bir tane alır. Excel Çalışma kitabı çıktısı alınır. Motor, her sayfadaki tablo yapılarını algılar ve bunları elektronik tablo hücreleri olarak yeniden oluşturur, çevreleyen metni de yan yana çıkarır. qualityType hızlı metin katmanı çıkarma arasında geçiş yapar (Taslak) ve taramalar için sayfa başına tanıma (Yüksek), Ve ocrWhenNeeded koşuyor OCR Sayfada metin katmanı olmadığında otomatik olarak. Yanıt ham veridir. .xlsx ikili (200) veya bir Location anket URL (202).

İ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

POST/api/v2/ConvertPdfToExcel

Kaçırmamanız Gereken Önemli Bilgiler

Draft ve High farklı şekilde faturalandırılır.
Taslak maliyeti 1 API Dosya başına çağrı yapar ve mevcut metin katmanını okur. Yüksek maliyetli 2 API Sayfa başına çağrı yapar ve her sayfayı yeniden işler; bu da taranan verinin kalitesini belirler. PDFs Çalışmak. Temiz dijital ortamda uyuşturucu etkisi altında çalışmayın. PDFsSayfa başına hiçbir şey için para ödemiyorsunuz.
outputFormat Ve ocrWhenNeeded mantıksal değerlerdir
Resmi kod örnekleri gönderildi doğru / YANLIŞ JSON Her iki alan için de mantıksal değerler. Bu sayfanın eski sürümlerinde metin değerleri gösteriliyordu. "Evet"Aşağıdaki örneklerde olduğu gibi mantıksal değerler kullanın.
Async 202 + getiri sağlıyor Location başlık
İle asenkron: doğru o API 202 ile yanıt verebilir Location başlık. GET O URL (Aynı AuthorizationÇalışma kitabı ikili dosyasıyla 200 değerini döndürene kadar bu işleme devam edilir. Resmi örnekler her 10 saniyede bir, en fazla 10 kez deneme yapar.

HTTP kurmak

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

Göndermek asenkron: doğru Vücutta. 200 dönüştürülmüş değeri döndürür. .xlsx Çalışma kitabı ikili baytlar olarak. 202 bir döndürür Location anket içeren başlık URL; GET O URL aynı şekilde Authorization Başlık, çalışma kitabı ikili dosyasıyla 200 değerini döndürene kadar görüntülenir.

Hangi kalite modunu seçmeliyim: Taslak mı yoksa Yüksek mi?

Taslak, dijital olarak oluşturulmuş bir nesnenin içinde zaten var olan metin katmanını okur. PDFYüksek çözünürlük, her sayfayı yeniden oluşturur ve tanır; bu daha yavaş ve daha maliyetlidir, ancak taranmış belgelerde, fotoğraflarda ve yalnızca görüntü içeren dosyalarda çalışan tek moddur. pages.

Taslak vs YüksekTaslakYüksek
En iyisiDijital olarak oluşturuldu PDFs seçilebilir metin ileTaranmış veya görüntü tabanlı PDFs
Maliyet1 API dosya başına çağrı2 API sayfa başına çağrılar
OCRUygulanmadıSayfa başına uygulanır (eşleştirme ile) ocrWhenNeeded: true)
HızHızlı, tek geçişliDaha yavaş, sayfa başına tanıma
Masalar tekrar boşaldığındaYüksek ayarlarla tekrar deneKontrol etmek language metin bozuksa

API vücut alanları

ParametreGerekliTipNe işe yarar?Örnek
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

Örnek yükler

Taslak modu. dijital PDF seçilebilir metin ile

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

Yüksek mod. tarandı. PDF ile OCR

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

Postacı tahsilat ipuçları

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

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

Ne anlama geliyor? API geri dönmek?

Başarılı bir dönüşüm, aşağıdaki sonucu döndürür. Excel çalışma kitabının kendisi değil. JSON sarmalayıcı. Çıktı modern bir yapıdır. Ofis Açık XML çalışma kitabı (.xlsx), varsayılan XML-tabanlı format her mevcut sürüm tarafından desteklenmektedir ExcelAşağıdaki üç durumu ele alın.

AlanTipİçeriğinde neler var?
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.

Kod örnekleri

Her biri örnek içeren, uçtan uca uygulamalar üzerinde çalışıyoruz. PDF ve bu sayfadaki tam içerik:

SSS

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.

İlgili işlemler

Diğer platformlarda aynı görev

Yardım Alın