2016-07-03 5 views
0

Google 드라이브에 저장된 PDF 문서가 있습니다. Google 드라이브 웹 UI 검색을 사용하여 문서의 텍스트를 찾을 수 있습니다.Google에서 PDF로 텍스트 가져 오기

Google Apps Script를 사용하여 프로그래밍 방식으로 문서의 일부 텍스트를 추출하려면 어떻게해야합니까?

+0

http://stackoverflow.com/questions/23771146/google-drive-php-api-how-to-stream-a-large-file : myPDF.pdf, 여기 당신이 할 것입니다 –

답변

0

pdfToText()this gist에서 참조하십시오.

PDF 파일의 Google 드라이브에 내장 된 OCR을 호출하려면 다음과 같이하십시오.

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... 
}