跳到主要内容

从中提取资源 PDFMake

本模块的功能

PDF4me提取资源 从文件中提取所有嵌入的图像和文本内容 PDF 并将它们作为结构化数据返回到您的位置。 Make 场景切换 提取图像 以命名方式检索文档中嵌入的每个图像, Base64编码文件。切换 提取文本 以纯字符串形式检索全文内容。两者可以在单个模块调用中同时运行。使用提取的图像构建资源库,使用提取的文本进行分析、搜索索引或翻译,所有操作均无需打开文件。 PDF 手动操作。

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

验证您的身份 API 要求

每一个 PDF4me 模块 Make 需要有效 联系创建或选择一个可以容纳您的 PDF4me API 关键在于确保该方案能够安全地验证提取请求。

您不容错过的重要事实

图像数组需要一个迭代器来逐个处理。
Images 的输出是一个数组,每个数组元素对应一张嵌入的图片。要单独上传或处理每张图片,请添加一个 Make 迭代器 在“提取资源”模块之后立即执行该模块,并将其指向“图像”数组。每次迭代都会生成一张图像。 姓名 字段(文件名)和一个 数据 字段(Base64 内容)。如果没有迭代器,您将无法在下游访问单个图像。
图像数据是 Base64上传前先解码
每张图片的 数据 字段采用 Base64 编码。云存储模块(Dropbox、Google Drive、 SharePoint预期为二进制数据,而非 Base64 文本。使用 Make内置的 toBinary(Data, 'base64') 该函数用于在将数据字段传递给上传模块之前,将其转换为二进制格式。 姓名 该字段提供带有扩展名的原始文件名(例如: image_001.png)。
文本提取功能在原生平台上运行。 PDFs未扫描
“提取文本”切换按钮用于检索嵌入在文本中的可搜索文本。 PDF 结构扫描 PDFs 由于扫描文档基于图像,不包含嵌入式文本层,因此扫描文档的文本输出将为空或内容极少。要从扫描页面中提取文本,请运行以下命令。 PDF OCR 首先使用模块创建文本图层,然后使用“提取资源”提取文本。图像提取适用于所有情况。 PDFs 包括扫描件。
将 PDF4me 提取资源模块的“连接”设置为“我的 PDF4me 连接”,“文件名”映射自步骤 1,“文档”映射自步骤 1 的数据,“提取图像”设置为“是”,“提取文本”设置为“是”。

“提取图像”和“提取文本”是两个独立的开关,您可以根据需要启用其中一个、两个都启用或只启用其中一个。图像以数组形式返回;文本以纯字符串形式返回。

参数

必需的: 必须提供连接信息、文件名、文档、提取图像和提取文本。至少要将“提取图像”或“提取文本”设置为“是”,如果两者都不启用,则不会返回任何内容。

范围必需的它的作用例子
ConnectionYesPDF4me API connection. Click Add and paste your API key if connecting for the first time.My PDF4me connection
File NameYesFilename of the source PDF including .pdf extension. Map from the prior module's file name output.catalog.pdf
DocumentYesBinary content of the source PDF. Map from the prior module's data output: Dropbox, Google Drive, HTTP, or email attachment.1. Data
Extract ImagesYesToggle to extract all embedded images. Set to Yes to retrieve images as a named Base64 array. Set to No to skip image extraction. Can be combined with Extract Text.Yes
Extract TextYesToggle to extract all text content. Set to Yes to retrieve the full document text as a plain string. Set to No to skip text extraction. Works on native PDFs only: not scanned.Yes

输出字段

场地类型描述
文本String从以下位置提取的全文内容 PDF 作为纯字符串。如果“提取文本”设置为“否”,则为空。 PDF 已扫描。
图片Array包含所有嵌入图像的数组。每个元素都有一个 姓名 (带扩展名的文件名) 数据Base64-编码后的图像内容)。如果“提取图像”为否,则数组为空。

快速设置

  1. 添加 PDF4me提取资源 致你 Make 文件下载步骤之后的场景。
  2. 选择 联系 (或点击) 添加 用你的 API 钥匙)。
  3. 地图 文件名文档 来自上一模块。
  4. 提取图像 和/或 提取文本是的 根据你的需求而定。
  5. 如果要提取图像,请添加一个 迭代器 指向的模块 图片 数组。在迭代器内部,使用 toBinary(Data, 'base64') 对每张图片进行解码,并将其传输到上传模块。
  6. 如果提取文本,请映射 文本 将字段直接插入 Google 表格行、数据库插入或 HTTP 正文。

工作流程示例

工作流程示例Common Make scenario patterns using Extract Resources.
从产品目录构建图像库 PDFs
  1. Dropbox 监视文件夹会在新目录创建时触发 PDF 已上传。
  2. Dropbox 下载文件会检索该文件 PDF 二进制。
  3. “提取资源”功能在“提取图像”设置为“是”、“提取文本”设置为“否”的情况下运行。
  4. 迭代器遍历 Images 数组,每次迭代遍历一张图像。
  5. 每次迭代都会对数据字段进行解码。 toBinary(Data, 'base64') 并将图像上传到 Google 云端硬盘的“产品图片”文件夹,文件名使用“名称”字段。
索引合同文本以进行全文检索
  1. Google 云端硬盘监控文件功能会在签订新合约时触发。 PDF 已添加到“合同”文件夹。
  2. Google 云端硬盘的“获取文件”功能会下载二进制文件。
  3. 提取资源时,将“提取文本”设置为“是”,将“提取图像”设置为“否”。
  4. 文本输出将与文件名和上传日期一起写入 Airtable 记录。
  5. 现在合同全文可在 Airtable 中搜索,无需手动复制粘贴。
迁移旧系统 PDFs文本导入数据库,图像导入媒体库
  1. Google Sheets 中的一行 PDF URL 会触发迁移列表中每个旧文档的场景。
  2. 一个 HTTP 模块下载 PDF 来自网址。
  3. 提取资源时,提取文本和提取图像都设置为“是”。
  4. 文本字段插入到 MySQL 用于全文检索的数据库记录。
  5. 迭代器将提取的每个图像上传到 SharePoint 媒体库,无需打开即可完成内容迁移 PDFs 手动操作。

常见问题解答

How do I save each extracted image to cloud storage?+
Add a Make Iterator module after Extract Resources and point it at the Images array output. Each iteration yields one image object with a Name field (original filename with extension, e.g. image_001.png) and a Data field (Base64-encoded content). Convert Data to binary using Make's toBinary(Data, 'base64') function, then pipe the binary into a Dropbox Upload a File, Google Drive Upload a File, or SharePoint module: using the Name field as the destination filename.
Can I extract only images, only text, or both?+
The two toggles are fully independent. Set Extract Images to Yes and Extract Text to No to retrieve only images. Set Extract Text to Yes and Extract Images to No for text only. Enable both to retrieve everything in a single module call: PDF4me processes the document once and returns both outputs together, which is more efficient than running the module twice.
Will text extraction work on scanned PDFs?+
Scanned PDFs are essentially images of pages: they contain no embedded text layer. The Extract Text toggle retrieves text from the PDF's internal text structure, which only exists in digitally created (native) PDFs. For scanned documents, the Texts output will be empty or contain only minimal metadata. Run a PDF OCR module first to add a text layer to the scanned PDF, then use Extract Resources to pull the text.
What image formats are returned: PNG, JPG, or something else?+
The format depends on how each image is stored inside the PDF. Most PDFs embed images as JPEG or PNG. The Name field in each Images array item includes the original extension (e.g. image_001.jpg or image_002.png) so you know the format before saving. The Data field is always Base64 regardless of the underlying format.
Does the module modify or damage the source PDF?+
No. Extract Resources is a read-only operation. It reads the PDF content and returns copies of the embedded text and images: the source file in Dropbox, Google Drive, SharePoint, or any other location is completely untouched. You can run Extract Resources on the same PDF multiple times without any side effects.

相关模块

获取帮助