本文介绍了使用谷歌应用程序脚本(可能还有驱动器API)使用OCR上传PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Google Apps脚本从网络上传PDF,但我想在自动执行OCR的同时上传它。到目前为止,我可以上传它,但我不知道如何执行OCR。

I'm using Google Apps script to upload a pdf from the web, but I'd like to upload it while automatically performing OCR. So far, I can upload it, but I don't know how to perform OCR on it.

  var link = "http://ilwu13.com/dispatches/" ;
  var date_str = "011813" ; //My code creates this based on today's date
  var link_end = "_DF.pdf" ;

  link = link + date_str + linkend ;


  var urlfetch = UrlFetchApp.fetch(link) ;
  var fileBlob = urlfetch.getBlob();
  var new_gdoc = DocsList.createFile(fileBlob) ;

我明白这个问题已经在这篇文章中得到解答,,但 Google文档列表API在发布之后已被正式弃用。

I understand this question was already answered in this post, https://developers.google.com/google-apps/documents-list/#uploading_documents_using_optical_character_recognition_ocr, but the "Google Documents List API has been officially deprecated" after it was posted.

弃用的DocsList API将一直运行到2015年,但我想要一个更稳定的解决方案。

The deprecated DocsList API will work until 2015, but I'd like a more stable solution.

推荐答案

这可以通过Drive API实现。请参阅方法,特别注意 ocr ocrLanguage 参数。

This is possible with the Drive API. See the drive.files.insert method with special attention to the ocr and ocrLanguage parameters.

这篇关于使用谷歌应用程序脚本(可能还有驱动器API)使用OCR上传PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-03 01:14