批次轉換 pdf 和可搜尋 pdf

批次轉換 pdf 和可搜尋 pdf

我正在尋找一種將數千個 pdf 轉換為可搜尋 pdf 的方法。我使用了 Nuance 附帶的一個名為“PDF 創建助手”的程序電子複製軟體.但是,您無法選擇資料夾,您必須進入每個子資料夾,選擇要轉換的文件,然後轉到下一個資料夾。

將大量 pdf 轉換為可搜尋 pdf 的另一種方法是什麼?

沒有任何建議。當然一定有一種方法可以批量轉換pdf(?)。

答案1

使用 BIN 資料夾中的 CPYCONVERTER.EXE 檔案作為命令列(eCopy Ver.9-Paperworks 支援通配符) 這適用於 8.5 eCopy Desktop。

Command Line Cpy Converter Version 8.5 (Build 0.116)
 Copyright c 1992 - 2004. All rights reserved.

 Converts CPY to CPY, CPY to TIF or TIF to CPY

Usage:
 cpyconverter.exe [-?] -S=<source path> -D=<dest path> [-P] [-E] [-Q] [-B] [-O]
[-T3/T4/TC/C/U]

Note:
 Wildcards are not supported.  Full paths must be used for source and destinatio
n

Switches:
--------------------
-?                      : This menu
-Q                      : Turn off logging.
-P                      : Converter pauses after conversion.
-E                      : Converter pauses if there is an error.
-B                      : Converter burns-in Blackout/Whiteout markups (if appli
cable).
-O                      : Converter OCRs document and creates searchable text (i
f applicable).
-S="<SOURCE PATH>"      : The path of the file to convert.
-D="<DESTINATION PATH>" : The path of the newly converted file.
-P=<PASSWORD>           : Password for encrypting and decrypting documents.
--------------------
 * If the source document is encrypted CPY converter will attempt to decrypt it
to the destination document with the supplied password.
 * If the source document is not encrypted CPY converter will attempt to encrypt
 the destination document using the supplied password.
 * Please note you cannot encrypt/decrypt tif documents.

-<Conversion Type>      : The type of conversion to be done(T3, T4, TC, C, U)
--------------------
* T4 - Convert CPY to TIF Group4
* T3 - Convert CPY to TIF Group3
* C  - Convert TIF(Any group) to CPY
* U  - Convert CPY to CPY

Ex.1 cpyconverter.exe -S="C:\My Dir\test.tif" -D="C:\My Dir\test.cpy" -C
Convert Tiff to cpy

Ex.2 cpyconverter.exe -S="C:\My Dir\test.cpy" -D="C:\My Dir\test.tif" -T3
Convert Cpy to Tif Group 3

Ex.3 cpyconverter.exe -S="C:\My Dir\test.cpy" -D="C:\My Dir\test.tif" -T4
Convert Cpy to Tif Group 4

答案2

在Linux上

首先,您需要對PDF尚未 OCR 的 s 進行 OCR,我寫了一個非常簡單的方法來搜尋所有無法編輯的 pdfgrep並對其進行 OCR。

我注意到如果pdf文件沒有任何字體,通常無法搜尋。所以知道了這一點我們就可以使用pdffonts.

前兩行pdffonts是表頭,因此當文件可搜尋時有兩行以上的輸出,知道這一點我們可以創建:

gedit check_pdf_searchable.sh

然後貼上這個

#!/bin/bash 
#set -vx
if ((`pdffonts "$1" | wc -l` < 3 )); then
echo $1
pypdfocr "$1"
fi

然後使其可執行

chmod +x check_pdf_searchable.sh

然後列出目錄中所有不可搜尋的 pdf:

ls -1 ./*.pdf | xargs -L1 -I {} ./check_pdf_searchable.sh {}

或在目錄及其子目錄中:

tree -fai . | grep -P ".pdf$" | xargs -L1 -I {} ./check_pdf_searchable.sh {}

答案3

最簡單的方法是使用線上OCR API。 ocr.space api 支援創建可搜尋的 PDF。該服務的免費套餐為每月 25,000 次轉換。

然後,您可以使用 Powershell、批次或任何其他腳本語言自動執行此操作。例如,使用 cURL 觸發批次轉換:

curl -H "apikey:helloworld" --form "[email protected]" --form "language=eng" -form "isOverlayRequired=true" https://api.ocr.space/Parse/Image

相關內容