Lewati ke konten utama

Uraikan Dokumen di n8n

Fungsi node ini

PDF4me Uraikan Dokumen menjalankan templat parse yang Anda simpan terhadap PDF di dalam sebuah n8n alur kerja dan mengembalikan bidang yang diekstrak sebagai data terstruktur. Masukkan data biner dari node sebelumnya, sebuah Base64 string, atau publik URL, merujuk pada templat dengan ID Parse, dan salurkan hasilnya JSON, XML, atau CSV langsung ke Set, IF, Permintaan HTTP, atau hilir lainnya n8n Node. Template tersebut membawa logika ekstraksi, sehingga node yang sama mengekstrak faktur, kontrak, tanda terima, dan tata letak khusus apa pun yang telah Anda konfigurasi.

Postingan Blog Terkait(1)

Sebelum Anda menjalankan node ini: buat templat parse di PDF4me Dasbor. Tentukan kunci tangkapan Anda dan pilih Ekspresi Regex untuk pola yang stabil atau JavaScript Ekspresi untuk logika kondisional. The n8n referensi node yang templat oleh ID Parse. Melihat Siapkan Informasi Penguraian untuk Dokumen Untuk pengaturan lengkap, contoh Regex (INV-\d{6,10}, \d{2}/\d{2}/\d{4}), dan dua pekerja JavaScript Contoh pengklasifikasi ekspresi.

Memverifikasi Identitas Anda API Meminta

Yang PDF4me simpul di n8n memerlukan PDF4me API kredensialBuat kredensial sekali di n8n dengan milikmu API ambil kunci dari dasbor, lalu rujuk kunci tersebut dari setiap PDF4me simpul dalam alur kerja Anda.

Fakta Penting yang Tidak Boleh Anda Lewatkan

ID Parse diperlukan (ini adalah TemplateId Anda)
Parse ID adalah GUID yang diberikan oleh dasbor saat menyimpan perubahan pada templat. Salin dari panel detail templat dan tempelkan ke dalam n8n Tanpa itu, node tidak memiliki peta bidang mana yang akan diekstrak.
Ekspresi reguler untuk pola stabil, JavaScript untuk logika kondisional
Tangkap kunci secara langsung di dalam templat. Gunakan Ekspresi Regex untuk nomor faktur, tanggal, jumlah, ID pajak (sekitar 80% dari kunci produksi). Gunakan JavaScript Ekspresi dengan teks variabel untuk klasifikasi dan aturan cadangan.
Outputnya berupa data terstruktur, bukan biner. PDF
Tidak seperti node Compress, Protect, atau Convert yang mengembalikan data mentah. PDF byte, Penguraian Dokumen mengembalikan JSON (bawaan), XML, atau CSV di bidang biner yang Anda beri nama. Hubungkan ke node Set atau IF untuk mengarahkan nilai-nilai tersebut ke hilir.
Konfigurasi node Parse Document di n8n

Parameter

ParameterDiperlukanApa fungsinya?Contoh
Input Data TypeYesHow the PDF reaches the node. Binary Data (from a prior node), Base64 String (inline encoded), or URL (public file URL).Binary Data
Input Binary FieldConditionalName of the binary field on the input item containing the PDF. Required when Input Data Type is Binary Data.data
Base64 PDF ContentConditionalBase64 encoded PDF content. Required when Input Data Type is Base64 String. No data: prefix.JVBERi0xLjQK...
PDF URLConditionalPublicly reachable URL of the PDF. Required when Input Data Type is URL. The PDF4me service downloads and processes it.https://example.com/invoice.pdf
Document NameYesSource filename including .pdf extension. Used for format detection and error tracing.invoice.pdf
Parse IDYesTemplateId GUID from the PDF4me dashboard. Identifies the parse template (capture keys + extraction rules) to apply.12345678-1234-1234-1234-123456789abc
Output FormatYesShape of the returned data. JSON (default, structured object), XML (hierarchical), or CSV (flat tabular). JSON is the right choice for almost every n8n workflow.JSON
Output Binary Field NameYesName of the binary field the node attaches the parsed output to on the output item. Reference it from downstream nodes.data
Custom ProfilesNoAdvanced JSON-style overrides for parsing behaviour (output sub-format, include metadata flag, etc). Leave empty for default behaviour.{ "outputDataFormat": "json", "includeMetadata": true }

Jenis ekspresi dalam templat parse Anda

Aturan pengambilan data terdapat di dalam templat, bukan di dalam n8n node. Kedua tipe ekspresi tersebut disertakan dengan setiap node. PDF4me akun.

Ekspresi RegexPola yang stabil
Nomor faktur (INV-\d{6,10}), tanggal (\d{2}/\d{2}/\d{4}), jumlah ($?\d{1,3}(?:,\d{3})*(?:.\d{2})?). Sekitar 80% kunci produksi.
Ekspresi JavaScriptLogika kondisional dan pengklasifikasi
Teks area tangkapan diteruskan sebagai teks; mengembalikan string. Klasifikasi multi-marker, aturan cadangan, normalisasi tanggal. Lihat Siapkan Informasi Penguraian untuk Dokumen untuk dua sampel kerja.

Keluaran

BidangJenisIsi di dalamnya
fileNameStringGenerated output filename with timestamp and extension matching Output Format (.json / .xml / .csv).
mimeTypeStringMIME type of the output (application/json, application/xml, text/csv).
fileSizeNumberSize of the parsed output in bytes.
successBooleantrue on a successful parse, false otherwise. Wire into an IF node for branching.
messageStringStatus message. Document parsed successfully on the happy path, or a descriptive error.
docNameStringOriginal input filename, preserved for audit trails.

Data key/value yang telah diurai itu sendiri berada di field biner yang Anda beri nama di Nama Bidang Biner Keluaran.

Contoh alur kerja

Pola alur kerja n8n umumTypical ways to chain Parse Document into an n8n workflow.
Lampiran email ke Postgres
  1. Gmail Trigger akan aktif saat ada faktur baru yang diberi label vendor-invoice.
  2. Filter hanya akan meneruskan lampiran yang berakhiran .pdf.
  3. Parse Document menjalankan templat Faktur terhadap lampiran biner.
  4. Atur peta node yang diuraikan invoiceNumber, totalAmount, invoiceDate.
  5. Perintah INSERT di Postgres menulis baris ke dalam tabel accounts_payable.
Klasifikasi dan ekstraksi dalam satu alur kerja.
  1. Webhook menerima PDF dari portal unggahan mitra.
  2. Parse Document menjalankan template dengan sebuah JavaScript Ekspresi kunci yang mengembalikan tipe dokumen.
  3. Alihkan rute node pada tipe yang dikembalikan (faktur / pesanan / tanda terima) ke cabang hilir spesifik tipe tersebut.
  4. Setiap cabang mengirimkan bidang yang telah diuraikan ke sistem tujuan yang tepat.
Penguraian batch dari S3 ke Airtable
  1. Pemicu terjadwal akan aktif setiap 15 menit.
  2. S3 List + Get Object memuat setiap objek baru PDF di dalam bucket masuk.
  3. Parse Document menjalankan templat terhadap setiap item biner.
  4. Fungsi Airtable Create Record menulis kolom-kolom yang telah diuraikan ke dalam basis data pelacakan.

Pertanyaan yang Sering Diajukan

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.

Tindakan terkait

Tugas yang sama di platform lain

Dapatkan Bantuan