【问题标题】:Extracting text from PDF - Rstudio从 PDF 中提取文本 - Rstudio
【发布时间】:2023-04-06 20:39:01
【问题描述】:

使用 pdftools 库,我只能提取 3 页 30 页的 pdf 文件。 可能是什么问题?如何从所有页面中提取文本?前 3 页包含普通文本,许多其他页面包含表格列

【问题讨论】:

    标签: r pdf text pdftotext


    【解决方案1】:

    您可以通过将 pdf 转换为图像格式,然后执行 OCR 部分来做到这一点。 More info

    使用pdftools 包中的pdf_convert 函数

    pngText <- pdftools::pdf_convert('https://jeroen.github.io/images/ocrscan.pdf', dpi = 600)
    

    那么,

    text <- tesseract::ocr(pngText)
    cat(text)
    

    让我知道这是否有效。

    【讨论】:

      猜你喜欢
      • 2015-08-17
      • 2019-12-13
      • 1970-01-01
      • 2011-04-30
      • 1970-01-01
      • 2013-02-05
      • 2019-12-05
      • 2015-03-19
      相关资源
      最近更新 更多