メインコンテンツへスキップ

ドキュメントを解析 n8n

このノードの機能

PDF4me ドキュメントを解析する 保存した解析テンプレートを PDF 内部 n8n ワークフローを実行し、抽出されたフィールドを構造化データとして返します。前のノードからのバイナリデータ、 Base64 文字列、または公開 URLテンプレートを参照するには IDを解析結果をパイプで送る JSON、 XML、 または CSV Set、IF、HTTPリクエスト、または下流の任意の処理に直接接続します。 n8n ノード。テンプレートには抽出ロジックが含まれているため、同じノードで請求書、契約書、領収書、および設定したカスタムレイアウトを抽出できます。

関連ブログ記事(1)

このノードを実行する前に: 解析テンプレートを作成する PDF4me ダッシュボード。キャプチャキーを定義して選択します。 正規表現 安定したパターンまたは JavaScript 表現 条件付きロジックの場合。 n8n ノードは、そのテンプレートを参照します。 IDを解析。 見る ドキュメントの解析情報を準備する 完全なセットアップについては、正規表現の例(INV-\d{6,10}、 \d{2}/\d{2}/\d{4})、そして2人の作業員 JavaScript 表現分類器のサンプル。

認証 API リクエスト​

の PDF4me ノード n8n 必要 PDF4me API 資格認証情報を一度作成します n8n あなたの API ダッシュボードからキーを取得し、すべてのキーを参照します。 PDF4me ワークフロー内のノード。

見逃してはならない重要な事実​

解析IDは必須です(これはあなたのテンプレートIDです)。
Parse ID は、テンプレートの変更を保存したときにダッシュボードによって割り当てられる GUID です。テンプレートの詳細パネルからコピーして貼り付けます。 n8n ノード。これがないと、ノードはどのフィールドを抽出するかのマップを持ちません。
安定したパターンの正規表現、 JavaScript 条件付きロジック
テンプレート内でキーをキャプチャします。請求書番号、日付、金額、納税者番号(本番環境のキーの約80%)には正規表現を使用します。 JavaScript 表現 文章 分類ルールとフォールバックルールのための変数。
出力は構造化データであり、バイナリデータではない。 PDF
Compress、Protect、Convertノードとは異なり、生データを返すノードとは異なり、生データを返すノードとは異なり、 PDF バイト、ドキュメントの解析結果 JSON (デフォルト)、 XML、 または CSV 指定したバイナリフィールドに格納します。それをSetノードまたはIFノードに接続して、値を下流にルーティングします。
n8nにおけるParse Documentノードの設定

パラメータ​

パラメータ必須その機能例
Input Data TypeRequiredChoose how to provide the document to parse. Options: Binary Data, Base64 String, URL. Default is `Binary Data`.Binary Data
Input Binary FieldConditionalName of the binary property that contains the document file. Shown when Input Data Type is Binary Data. Default is `data`.data
Base64 Document ContentConditionalBase64 encoded document content. Shown when Input Data Type is Base64 String.JVBERi0xLjQK...
Document URLConditionalURL to the document file to parse. Shown when Input Data Type is URL.
Document NameRequiredName of the source document file for reference. Default is `document.pdf`.document.pdf
Parse IDRequiredGUID of the parse configuration to use (will also be used as Template ID).12345678-1234-1234-1234-123456789abc
Output FormatOptionalFormat for the parsed document output. Options: JSON, Text File. Default is `JSON`.JSON
Output File NameConditionalName for the output file (only used when output format is text). Shown when Output Format is Text File. Default is `parsed_document.txt`.parsed_document.txt
Advanced OptionsOptionalOptional settings, collapsed behind Add Option.Add Option
Custom ProfilesOptionalUse "JSON" to adjust custom properties. Review Profiles at https://developer.pdf4me.com/api/profiles/index.html to set extra options for API calls.{ "outputDataFormat": "json", "includeMetadata": true }
Binary Data Output NameOptionalCustom name for the binary data in n8n output. Default is `data`.data

解析テンプレート内の式タイプ​

キャプチャルールはテンプレート内にあり、 n8n ノード。どちらの式タイプもすべてのノードに付属しています。 PDF4me アカウント。

正規表現安定したパターン
請求書番号(INV-\d{6,10})、日付(\d{2}/\d{2}/\d{4})、量($?\d{1,3}(?:,\d{3})*(?:.\d{2})?) 生産キーの約80%。
JavaScript式条件論理と分類器
キャプチャ領域のテキストは次のように渡されます 文章; 文字列を返します。マルチマーカー分類、フォールバックルール、日付正規化。参照 ドキュメントの解析情報を準備する 2つの作業サンプルについて。

出力​

分野タイプ内容物
successStringText File format only: always true.
messageStringText File format only: `Document parsed successfully`.
fileNameStringText File format only: the Output File Name.
mimeTypeStringText File format only: always `text/plain`.
fileSizeNumberText File format only: size of the text file in bytes.
traceIdStringText File format only: trace ID from PDF4me's response, if any.
documentTypeStringText File format only: document type from PDF4me's response, if any.
pageCountStringText File format only: page count from PDF4me's response, if any.
dataBinaryText File format only: a text file with a short header (date, trace ID, document type, page count) followed by PDF4me's full response as JSON.

JSON 形式のみ: アイテムは PDF4me 応答は、上記のフィールドが一切含まれていない状態で返されます。解析テンプレートで読み取られた値が含まれます(Power Automate コネクタでは traceId と parseInfo オブジェクト)。応答がテキストでない場合は、 JSON、contentType 付きの rawContent として返されます。 text/plain正確なフィールドは PDF4me 応答。

JSON 形式のみ: アイテムは PDF4meの応答は、上記のフィールドが一切含まれていない状態です。解析テンプレートで読み取られた値(Power Automate コネクタでは traceId と parseInfo オブジェクト)が含まれています。応答がテキストでない場合は、 JSON、contentType 付きの rawContent として返されます。 text/plain正確なフィールドは以下に依存します PDF4meの返答。

解析されたキー/値データ自体は、あなたが指定したバイナリフィールドに格納されます。 出力バイナリフィールド名。

ワークフローの例​

一般的なn8nワークフローパターンTypical ways to chain Parse Document into an n8n workflow.
PostgreSQLへのメール添付ファイル
  1. Gmailのトリガーは、「vendor-invoice」というラベルの付いた新しい請求書に対して作動します。
  2. フィルターは、拡張子が.pdfの添付ファイルのみを通過させます。
  3. Parse Documentは、バイナリ添付ファイルに対して請求書テンプレートを実行します。
  4. ノードマップを解析しました invoiceNumber、 totalAmount、 invoiceDate。
  5. PostgresのINSERT文は、行をaccounts_payableテーブルに書き込みます。
分類と抽出を1つのワークフローで行う
  1. Webhook は PDF パートナーアップロードポータルから。
  2. Parse Document はテンプレートを実行します JavaScript 文書タイプを返す式キー。
  3. 返されたタイプ(請求書/注文書/領収書)に基づいてノードの経路を切り替え、タイプ固有の下流ブランチに分岐します。
  4. 各ブランチは、解析されたフィールドを適切な宛先システムに送信します。
S3からAirtableへのバッチ解析
  1. トリガーの発火を15分ごとにスケジュール設定する。
  2. S3 リスト + オブジェクトの取得は、新しいオブジェクトをロードします PDF 受信バケット内。
  3. Parse Documentは、各バイナリアイテムに対してテンプレートを実行します。
  4. Airtableの「レコードの作成」機能は、解析されたフィールドを追跡ベースに書き込みます。

よくある質問​

What is a Parse ID and where do I get it?+
Parse ID is the TemplateId GUID generated by the PDF4me dashboard when you click Save Changes on a parse template. Find it in the template detail panel. Pin it in your n8n node so the same template runs every execution.
Do I need a template, or can the node parse any PDF without one?+
A template is required for field-level extraction in n8n. Without a Parse ID the node has no map of which regions to capture. Build a template once in the dashboard, then reuse the same Parse ID across runs and across platforms (Make, Zapier, Power Automate).
How does the n8n node know what fields to extract?+
The capture keys live in the template, not in n8n. Each capture area gets a key name (camelCase) and an extraction rule: Regex Expression for stable patterns or JavaScript Expression for conditional logic. The output has one field per key.
Which Input Data Type should I pick?+
Binary Data for files arriving from upstream nodes (Read Binary Files, HTTP Request with response format File, Gmail attachment, Dropbox Download). Base64 String when the PDF is encoded inline. URL when the file lives at a public web address.
Can I extract data using JavaScript Expression in addition to regex?+
Yes. The capture area text is passed as the variable text inside your JavaScript Expression and you return a string. Use it for multi-marker classification, fallback rules, or date normalization. See the Prepare Parse Info for Document guide for two working classifier samples.
JSON, XML, or CSV. Which Output Format should I use?+
JSON for almost every n8n workflow. It maps cleanly into Set, IF, and HTTP Request nodes. XML when your downstream system requires it natively. CSV for spreadsheet uploads and bulk imports.
Is the output a file I can save, or just a JSON object?+
Both. The parsed data is attached to the binary field you set under Output Binary Field Name, so you can Write Binary File to disk, send it as an email attachment, or upload it to storage. The structured data is also available on the regular json output for downstream node mapping.

関連アクション​

他のプラットフォームでも同じタスクを実行​

ヘルプが必要な場合​