変換する PDF に Excel
PDF4me 変換する PDF に Excel は REST テーブルとテキストを抽出するエンドポイント PDF 編集可能なものを返します Excel ワークブック。 POST 1 Base64 PDF に /api/v2/ConvertPdfToExcelドラフトまたは高品質を選択し、 OCR スキャンされたもの pages返された値を保存する .xlsx バイト単位。1回の呼び出しで、手動での再入力は不要です。
1つ送信します PDF 入って、1つ手に入れる Excel ワークブックが出力されます。エンジンは各ページ上の表構造を検出し、それをスプレッドシートのセルとして再構築し、周囲のテキストを抽出します。 qualityType 高速テキスト層抽出を切り替える(下書き)およびスキャンごとのページ認識(高い)、 そして ocrWhenNeeded 走る OCR ページにテキスト レイヤーがない場合、自動的に実行されます。レスポンスは生のデータです。 .xlsx バイナリ(200)または Location 投票 URL (202)
認証 API リクエスト
毎 PDF4me REST 電話にはあなたの API キー Authorization ヘッダーを基本認証として設定します。開発者ダッシュボードからキーを取得またはローテーションしてください。
終点
/api/v2/ConvertPdfToExcel見逃してはならない重要な事実
outputFormat そして ocrWhenNeeded ブール値です真実 / 間違い JSON 両方のフィールドにブール値を使用します。このページの古いバージョンでは、次のような文字列値が表示されていました。 "はい"以下のサンプルにあるように、ブール値を使用してください。非同期: true の API 202で応答する可能性がある Location ヘッダー。 GET それ URL (同じ Authorizationワークブックバイナリで200が返されるまで、)処理を続けます。公式サンプルでは、10秒ごとにポーリングを行い、最大10回再試行します。HTTP 設定
方法: POST
URL: https://api.pdf4me.com/api/v2/ConvertPdfToExcel
コンテンツタイプ: アプリケーション/json
Authorization: 基本 <あなたの PDF4me API キー>
送信 非同期: true 体内で。 200 変換されたものを返します .xlsx ワークブックをバイナリバイトとして保存します。 202 を返します Location アンケート付きのヘッダー URL; GET それ URL 同じ Authorization ワークブックバイナリで200が返されるまでヘッダーを実行します。
画質モードは「ドラフト」と「高画質」のどちらを選択すべきですか?
Draftは、デジタルで作成されたテキストレイヤー内に既に存在するテキストレイヤーを読み取ります。 PDF高解像度モードでは、すべてのページを再レンダリングして認識するため、処理速度は遅く、コストも高くなりますが、スキャン画像、文書の写真、画像のみに対応する唯一のモードです。 pages。
| ドラフト対ハイ | 下書き | 高い |
|---|---|---|
| 最適 | デジタルで作成された PDFs 選択可能なテキスト付き | スキャンまたは画像ベース PDFs |
| 料金 | 1 API ファイルごとの呼び出し | 2 API ページあたりの呼び出し回数 |
| OCR | 適用されません | ページごとに適用(ペア) ocrWhenNeeded: true) |
| スピード | 高速、シングルパス | ページごとの認識速度が遅い |
| テーブルが空になったとき | 高画質で再試行 | チェック language テキストが文字化けしている場合 |
API ボディフィールド
| パラメータ | 必須 | その機能 | 例 |
|---|---|---|---|
| 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. | true |
| docName | Optional | Source file name including its extension. Several actions dispatch on the extension, so it should always be set; when omitted a per-action default is used. Type: string. | invoice-report.pdf |
| docContent | Required | The source file. Accepts the base64-encoded file content, a `pdf4meblobid://<id>` reference to a previously uploaded blob, or an `https` URL to the source document. Required: an empty value fails with `File is empty`. Type: string. | JVBERi0xLjcK... |
| docContentBytes | Optional | Alternative raw byte payload for the source file. Type: string. | |
| callBackUrl | Optional | Optional URL notified when an asynchronous job completes. Type: string. | |
| qualityType | Optional | Conversion quality. An unrecognised value is rejected with 400. Type: string. | Draft |
| ocrWhenNeeded | Optional | Parsed as a boolean: pass `true` to run OCR when the source PDF has no text layer. Used by ConvertOcrPdf. Type: string. | true |
| mergeAllSheets | Optional | ConvertPdfToExcel: put every page into a single worksheet. Type: boolean. | true |
| language | Optional | OCR language, for example `English`. Type: string. | English |
| outputFormat | Optional | Used by ConvertPdfToExcel: set to `csv` to receive CSV instead of a workbook, and by ConvertVisio to pick the target format. Type: string. | true |
サンプルペイロード
下書きモード。デジタル PDF 選択可能なテキスト付き
{
"docContent": "JVBERi0xLjcKJcfsj6IKNSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZw...",
"docName": "invoice-report.pdf",
"qualityType": "Draft",
"mergeAllSheets": true,
"outputFormat": true,
"ocrWhenNeeded": true,
"async": true
}
ハイモード。スキャン済み PDF と OCR
{
"docContent": "JVBERi0xLjcKJcfsj6IKNSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZw...",
"docName": "scanned-statement.pdf",
"qualityType": "High",
"mergeAllSheets": false,
"language": "English",
"outputFormat": true,
"ocrWhenNeeded": true,
"async": true
}
郵便配達員の集荷に関するヒント
curlの例
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
何が API 戻る?
変換が成功すると、 Excel ワークブック自体ではなく、 JSON ラッパー。出力はモダンな オフィス営業中 XML ワークブック(.xlsx)デフォルト XML-ベースのフォーマット すべての現行バージョンでサポートされています Excel以下の3つのケースに対応してください。
| 分野 | タイプ | 内容物 |
|---|---|---|
| Response body (HTTP 200) | Binary | The 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) | Binary | The finished workbook, returned once processing completes. The official samples poll every 10 seconds, up to 10 retries. |
| Poll response (HTTP 202) | Empty | Job still processing. Wait and poll the same Location URL again. |
コードサンプル
エンドツーエンドの実装例(それぞれサンプル付き) PDF そして、このページからの正確なペイロードは次のとおりです。