跳到主要内容

PDFn8n

PDF 是一个 PDF4me 节点操作 n8n 构建一个新的 PDF 仅包含 pages 您可以列出所需内容。例如,您可以从合同中提取签名页,从手册中提取单个章节,或者仅向后续步骤提供摘要。 pages 而不是整个文档。

此节点的功能

PDF4me从以下位置提取页面 PDF 需要 PDF 来自二进制数据, Base64 String或者 URL 并返回一个仅包含以下内容的新文件: pages 命名 页码该字段代表整个操作:它接受单个 pages包括带连字符的范围、混合列表以及延伸到文档末尾的开放范围。由于它是作为工作流步骤运行的,因此相同的提取规则适用于所有未经任何人打开编辑器而到达的文件。

相关博客文章
目前尚无关于此功能的博客文章——敬请期待。
在此期间,您可以浏览 PDF4me 博客,查看适用于各平台的教程和工作流程。
访问博客

验证您的身份 API 要求

每一个 PDF4me 节点 n8n 需要有效 用于连接的凭证创建或选择一个可以容纳您的 PDF4me API 关键在于确保工作流程能够安全地验证提取请求。

您不容错过的重要事实

页码是唯一重要的字段。
此项为必填项,已验证。留空即可。 n8n 在节点运行之前标记该字段。
开放式范围可处理可变的页数。
写作 10- 意思是第 10 页到最后一页,因此一个设置可以适用于不同长度的文档。
页码从1开始编号。
第一页的值为 1,而不是 0。请注意,当前面的代码节点以编程方式生成页面列表时,这一点尤为重要。
n8n 中的 PDF4me 节点设置为“从 PDF 中提取页面”操作,输入数据类型为二进制数据,输入二进制字段为 data,文档名称为 output.pdf,页码字段为空(必填),输出二进制字段名称为 data。

PDF4mePDF 参数面板 n8n

提取页面与拆分页面 PDF

两者都会生成较小的文档,但它们回答的问题不同。提取操作问的是: pages 你想保留什么;拆分是指如何分割整个文档。

问题PDF分裂 PDF
How many files come backOne PDF holding the pages you listedSeveral PDFs covering the whole document
What happens to unlisted pagesThey are absent from the outputThey still appear, in another output file
Typical usePull the signature page, one chapter, or a summary sectionBreak a bundle into per-invoice or per-section files
Driven byAn explicit page list you supplyA split rule such as page count, text, or barcode

提取页面需要哪些参数? PDF 需要?

必需的: 操作、输入数据类型、与该输入类型匹配的字段、文档名称和页码。输出二进制字段名称具有一个工作默认值。 数据高级选项初始为空。

范围必需的它的作用例子
ActionRequiredSelects the PDF4me node action to run. Choose Extract Pages From PDF.Extract Pages From PDF
Input Data TypeRequiredFormat of the source PDF input. Choose Binary Data (from a previous node), Base64 String, or URL.Binary Data
Input Binary FieldConditionalName of the binary property on the incoming n8n item that holds the PDF. Required when Input Data Type is Binary Data. Defaults to data.data
Base64 Document ContentConditionalBase64-encoded content of the source PDF. Required when Input Data Type is Base64 String.JVBERi0xLjQK...
File URLConditionalPublicly reachable HTTPS URL to the source PDF. Required when Input Data Type is URL.https://example.com/report.pdf
Document NameRequiredFilename used for the document on the request, for reference and tracking. Include the .pdf extension.output.pdf
Page NumbersRequiredThe pages to keep. Accepts a comma-separated list, a hyphenated range, a mixed list, or an open range that runs to the end of the document. Pages are numbered from 1.1,3,5-8
Output Binary Field NameOptionalName of the binary property the output item exposes. Defaults to data.data
Advanced OptionsOptionalA collection that starts empty, shown as No properties with an Add Option button. Leave it alone unless you have a specific option to add.No properties

如何填写页码字段

图案例子返回的结果
Single page5Just page 5, as a one page PDF.
Comma-separated list1,3,5Pages 1, 3, and 5 in one PDF, with pages 2 and 4 absent.
Hyphenated range2-5Pages 2, 3, 4, and 5, with both ends included.
Mixed list1,3,5-8Page 1, page 3, then the block from 5 to 8.
Open range10-Page 10 through the last page, whatever the document length turns out to be.

输出字段

一次成功的运行返回一个 n8n 携带提取物的物品 PDF

场地类型它包含什么
Binary (data)BinaryThe extracted PDF, under Output Binary Field Name (default data).
fileNameStringGenerated filename of the extracted PDF.
mimeTypeStringMIME type of the output, always application/pdf.
fileSizeNumberSize of the returned PDF in bytes.
pagesExtractedNumberHow many pages ended up in the output. Compare it against the length of your requested list as a cheap sanity check.
originalPageCountNumberPage count of the source document before extraction.
extractedPageNumbersArrayThe page numbers that were actually extracted, useful for verifying the result against what you asked for.
successBooleanTrue when the extraction completed, false on failure. Use it to branch error handling.
messageStringHuman-readable status message, carrying success confirmation or error detail.

如何设置从中提取页面 PDFn8n

  1. 添加 PDF4me 致你 n8n 工作流程并选择 PDF 行动。
  2. 用于连接的凭证请选择您的 PDF4me 凭证或点击 创建新凭证 并粘贴你的 API 钥匙。
  3. 输入数据类型二进制数据 (默认), Base64 String, 或者 URL 并提供匹配的来源 PDF 场地。
  4. 文档名称 对于源文件,包括 .pdf 扩大。
  5. 进入 页码 使用列表、范围、混合列表或开放范围。
  6. 离开 输出二进制字段名称 作为 data 除非后面的节点期望不同的属性。
  7. 执行节点并路由返回结果 PDF 进入下一步,例如存储、电子邮件或审核队列。

典型配置

工作流程示例Common n8n workflow patterns using Extract Pages From PDF.
从合同中取出签名页
  1. 签署后的合同将以电子邮件附件的形式发送给您。
  2. PDF 使用开放范围获取最后一页。
  3. 该单页文件已归档至客户记录中,以便快速查阅。
只需将摘要发送给审稿人
  1. 系统会按计划生成一份长篇报告。
  2. PDF 保留前几个 pages 范围例如 1-3
  3. 审稿人会收到摘要,而完整报告则会存档。
从手册中截取一个章节
  1. 支持请求中引用了产品手册的某一章节。
  2. PDF 用连字符连接该章节。
  3. 客户获得相关信息 pages 而不是大型附件。
提取后合并成消化物
  1. 多份原始文件中,每份都只有一页值得保留。
  2. PDF 每个文档运行一次以获取该页面。
  3. 合并多个 PDFs 将结果合并成一个摘要。

实用技巧

Use an open range for variable documents
When the page count differs between files, 10- keeps everything from page 10 onward without knowing the total.
Check pagesExtracted against your request
Comparing the returned count with the number of pages you asked for catches a malformed page list before it reaches the customer.
Remember pages start at 1
A code node that builds the list from a zero-based array will be off by one on every document. Add one when generating the string.
Extract before you merge
Pulling the wanted pages from each source first keeps the merge step small and the final document free of filler.
Branch on the success field
Test the returned success boolean before sending the file onward so a failed extraction raises an alert instead of forwarding an empty result.
Reuse one source for several subsets
The original is untouched, so the same PDF can feed two extraction nodes to produce an internal copy and a customer copy in one run.

速查表

场地价值
ActionExtract Pages From PDF
Input Data TypeBinary Data
Input Binary Fielddata
Document Nameoutput.pdf
Page Numbers1,3,5-8
Output Binary Field Namedata
Advanced OptionsNo properties
CredentialsPDF4me API credential

常见问题

How do I write the Page Numbers field to extract a range?+
Page Numbers accepts four shapes. A comma-separated list such as 1,3,5 pulls individual pages. A hyphenated range such as 2-5 pulls everything between and including those pages. A mixed list such as 1,3,5-8 combines both. An open range such as 10- runs from page 10 to the end of the document, which is useful when the page count varies between files.
Is extracting pages the same as splitting a PDF?+
No. Extract Pages From PDF returns one new PDF containing only the pages you listed, and the pages you did not list are simply absent. Splitting divides a document into multiple output files covering the whole document. Choose extraction when you want a specific subset, and choose Split PDF when you want every page distributed across several files.
Does extracting pages change the original PDF?+
No. The node reads the source PDF you supply and returns a new file. The original document is untouched, so the same source can be run through several extractions in one workflow to produce different subsets.
What happens if I ask for a page number that does not exist?+
Page Numbers is a required field and is validated when the node runs. Requesting a page beyond the end of the document is an error case rather than a silent skip, so branch on the returned success field before passing the result downstream, especially when the page list is built dynamically from earlier workflow data.
Are the page numbers counted from one or from zero?+
Page numbers start at 1, matching what a reader sees in a PDF viewer. The first page of the document is 1, not 0. This matters most when the page list is generated by an earlier node in n8n code, where zero-based indexing is a common source of off-by-one output.

相关操作

在其他平台上执行相同任务

获取帮助