.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4. .TH OCRMYPDF "1" "November 2016" "ocrmypdf 4.3.2" "User Commands" .SH NAME ocrmypdf \- add an OCR text layer to PDF files .SH DESCRIPTION usage: ocrmypdf [\-h] [\-\-verbose [VERBOSE]] [\-\-version] [\-n] [\-\-flowchart FILE] .IP [\-l LANGUAGE] [\-j N] [\-\-image\-dpi DPI] [\-\-output\-type {pdfa,pdf}] [\-\-title TITLE] [\-\-author AUTHOR] [\-\-subject SUBJECT] [\-\-keywords KEYWORDS] [\-r] [\-\-remove\-background] [\-d] [\-c] [\-i] [\-\-oversample DPI] [\-f] [\-s] [\-\-skip\-big MPixels] [\-\-tesseract\-config CFG] [\-\-tesseract\-pagesegmode PSM] [\-\-pdf\-renderer {auto,tesseract,hocr}] [\-\-tesseract\-timeout SECONDS] [\-\-rotate\-pages\-threshold CONFIDENCE] [\-k] [\-g] input_file output_file .PP Generates a searchable PDF or PDF/A from a regular PDF. .PP OCRmyPDF rasterizes each page of the input PDF, optionally corrects page rotation and performs image processing, runs the Tesseract OCR engine on the image, and then creates a PDF from the OCR information. .SS "positional arguments:" .TP input_file PDF file containing the images to be OCRed (or '\-' to read from standard input) .TP output_file output searchable PDF file (or '\-' to write to standard output) .SS "optional arguments:" .TP \fB\-h\fR, \fB\-\-help\fR show this help message and exit .TP \fB\-l\fR LANGUAGE, \fB\-\-language\fR LANGUAGE Language(s) of the file to be OCRed (see tesseract \fB\-\-list\-langs\fR for all language packs installed in your system). To specify multiple languages, join them with \&'+' or issue this argument once for each language. .TP \fB\-j\fR N, \fB\-\-jobs\fR N Use up to N CPU cores simultaneously (default: use all) .TP \fB\-\-image\-dpi\fR DPI for input image instead of PDF, use this DPI instead of file's .TP \fB\-\-output\-type\fR {pdfa,pdf} Choose output type. 'pdfa' creates a PDF/A\-2b compliant file for long term archiving (default, recommended) but may not suitable for users who want their file altered as little as possible. 'pdfa' also has problems with full Unicode text. 'pdf' attempts to preserve file contents as much as possible. .SS "Common options:" .TP \fB\-\-verbose\fR [VERBOSE], \fB\-v\fR [VERBOSE] Print more verbose messages for each additional verbose level. .TP \fB\-\-version\fR show program's version number and exit .SS "pipeline arguments:" .TP \fB\-n\fR, \fB\-\-just_print\fR Don't actually run any commands; just print the pipeline. .TP \fB\-\-flowchart\fR FILE Don't run any commands; just print pipeline as a flowchart. .SS "Metadata options:" .IP Set output PDF/A metadata (default: use input document's metadata) .TP \fB\-\-title\fR TITLE set document title (place multiple words in quotes) .TP \fB\-\-author\fR AUTHOR set document author .TP \fB\-\-subject\fR SUBJECT set document subject description .TP \fB\-\-keywords\fR KEYWORDS set document keywords .SS "Image preprocessing options:" .IP Options to improve the quality of the final PDF and OCR .TP \fB\-r\fR, \fB\-\-rotate\-pages\fR automatically rotate pages based on detected text orientation .TP \fB\-\-remove\-background\fR attempt to remove background from gray or color pages, setting it to white .TP \fB\-d\fR, \fB\-\-deskew\fR deskew each page before performing OCR .TP \fB\-c\fR, \fB\-\-clean\fR clean pages from scanning artifacts before performing OCR, and send the cleaned page to OCR, but do not include the cleaned page in the output .TP \fB\-i\fR, \fB\-\-clean\-final\fR clean page as above, and incorporate the cleaned image in the final PDF .TP \fB\-\-oversample\fR DPI oversample images to at least the specified DPI, to improve OCR results slightly .SS "OCR options:" .IP Control how OCR is applied .TP \fB\-f\fR, \fB\-\-force\-ocr\fR rasterize any fonts or vector objects on each page, apply OCR, and save the rastered output (this rewrites the PDF) .TP \fB\-s\fR, \fB\-\-skip\-text\fR skip OCR on any pages that already contain text, but include the page in final output; useful for PDFs that contain a mix of images, text pages, and/or previously OCRed pages .TP \fB\-\-skip\-big\fR MPixels skip OCR on pages larger than the specified amount of megapixels, but include skipped pages in final output .SS "Advanced:" .IP Advanced options for power users .TP \fB\-\-tesseract\-config\fR CFG additional Tesseract configuration files .TP \fB\-\-tesseract\-pagesegmode\fR PSM set Tesseract page segmentation mode (see tesseract \fB\-\-help\fR) .TP \fB\-\-pdf\-renderer\fR {auto,tesseract,hocr} choose OCR PDF renderer \- the default option is to let OCRmyPDF choose. The 'tesseract' PDF renderer is more accurate and does a better job and document structure such as recognizing columns. It also does a better job on non\-Latin languages. However, it does not work as well when older versions of Tesseract or Ghostscript are installed, and some combinations of arguments to do not work with \fB\-\-pdf\-renderer\fR tesseract. .TP \fB\-\-tesseract\-timeout\fR SECONDS give up on OCR after the timeout, but copy the preprocessed page into the final output .TP \fB\-\-rotate\-pages\-threshold\fR CONFIDENCE only rotate pages when confidence is above this value (arbitrary units reported by tesseract) .SS "Debugging:" .IP Arguments to help with troubleshooting and debugging .TP \fB\-k\fR, \fB\-\-keep\-temporary\-files\fR keep temporary files (helpful for debugging) .TP \fB\-g\fR, \fB\-\-debug\-rendering\fR render each page twice with debug information on second page .PP OCRmyPDF attempts to keep the output file at about the same size. If a file contains losslessly compressed images, and output file will be losslessly compressed as well. .PP PDF is a page description file that attempts to preserve a layout exactly. A PDF can contain vector objects (such as text or lines) and raster objects (images). A page might have multiple images. OCRmyPDF is prepared to deal with the wide variety of PDFs that exist in the wild. .PP When a PDF page contains text, OCRmyPDF assumes that the page has already been OCRed or is a "born digital" page that should not be OCRed. The default behavior is to exit in this case without producing a file. You can use the option \fB\-\-skip\-text\fR to ignore pages with text, or \fB\-\-force\-ocr\fR to rasterize all objects on the page and produce an image\-only PDF as output. .IP ocrmypdf \fB\-\-skip\-text\fR file_with_some_text_pages.pdf output.pdf .IP ocrmypdf \fB\-\-force\-ocr\fR word_document.pdf output.pdf .PP If you are concerned about long\-term archiving of PDFs, use the default option \fB\-\-output\-type\fR pdfa which converts the PDF to a standardized PDF/A\-2b. This converts images to sRGB colorspace, removes some features from the PDF such as Javascript or forms. If you want to minimize the number of changes made to your PDF, use \fB\-\-output\-type\fR pdf. .PP If OCRmyPDF is given an image file as input, it will attempt to convert the image to a PDF before processing. For more control over the conversion of images to PDF, use the Python package img2pdf or other image to PDF software. .PP For example, this command uses img2pdf to convert all .png files beginning with the 'page' prefix to a PDF, fitting each image on A4\-sized paper, and sending the result to OCRmyPDF through a pipe. img2pdf is a dependency of ocrmypdf so it is already installed. .IP img2pdf \fB\-\-pagesize\fR A4 page*.png | ocrmypdf \- myfile.pdf .SS "HTML documentation is located at:" .IP \fI\,/usr/share/doc/ocrmypdf/html/index.html\/\fP .PP after installing the ocrmypdf\-doc package.