在Google中从PDF获取文本 [英] Get text from PDF in Google
本文介绍了在Google中从PDF获取文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个保存在Google云端硬盘中的PDF文档.我可以使用Google云端硬盘网络用户界面搜索来查找文档中的文本.
I have a PDF document that is saved in Google Drive. I can use the Google Drive Web UI search to find text in the document.
如何使用Google Apps脚本以编程方式提取文档中的一部分文本?
How can I programmatically extract a portion of the text in the document using Google Apps Script?
推荐答案
请参见此要点.
要在PDF文件上调用Google云端硬盘内置的OCR,例如myPDF.pdf
,这是您的工作:
To invoke the OCR built in to Google Drive on a PDF file, e.g. myPDF.pdf
, here is what you do:
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...
}
这篇关于在Google中从PDF获取文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文