gpt4 book ai didi

pdf - 在 Google 中从 PDF 中获取文本

转载 作者:行者123 更新时间:2023-12-04 00:38:16 24 4
gpt4 key购买 nike

我有一个保存在 Google Drive 中的 PDF 文档。我可以使用 Google Drive Web UI 搜索来查找文档中的文本。

如何使用 Google Apps 脚本以编程方式提取文档中的一部分文本?

最佳答案

pdfToText()this gist .

在 PDF 文件上调用内置于 Google Drive 的 OCR,例如myPDF.pdf ,这是你要做的:

function myFunction() {
var pdfFile = DriveApp.getFilesByName("myPDF.pdf").next();
var blob = pdfFile.getBlob();

// Get the text from pdf
var filetext = pdfToText( blob, {keepTextfile: false} );

// Now do whatever you want with filetext...
}

关于pdf - 在 Google 中从 PDF 中获取文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38166664/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com