ocrmypdf - add an OCR text layer to PDF files
usage: ocrmypdf [-h] [--verbose [VERBOSE]] [--version] [-n] [--flowchart FILE] [-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 Generates a searchable PDF or PDF/A from a regular PDF. 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. positional arguments: input_file PDF file containing the images to be OCRed (or '-' to read from standard input) output_file output searchable PDF file (or '-' to write to standard output) optional arguments: -h, --help show this help message and exit -l LANGUAGE, --language LANGUAGE Language(s) of the file to be OCRed (see tesseract --list-langs for all language packs installed in your system). To specify multiple languages, join them with '+' or issue this argument once for each language. -j N, --jobs N Use up to N CPU cores simultaneously (default: use all) --image-dpi DPI for input image instead of PDF, use this DPI instead of file's --output-type {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. Common options: --verbose [VERBOSE], -v [VERBOSE] Print more verbose messages for each additional verbose level. --version show program's version number and exit pipeline arguments: -n, --just_print Don't actually run any commands; just print the pipeline. --flowchart FILE Don't run any commands; just print pipeline as a flowchart. Metadata options: Set output PDF/A metadata (default: use input document's metadata) --title TITLE set document title (place multiple words in quotes) --author AUTHOR set document author --subject SUBJECT set document subject description --keywords KEYWORDS set document keywords Image preprocessing options: Options to improve the quality of the final PDF and OCR -r, --rotate-pages automatically rotate pages based on detected text orientation --remove-background attempt to remove background from gray or color pages, setting it to white -d, --deskew deskew each page before performing OCR -c, --clean 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 -i, --clean-final clean page as above, and incorporate the cleaned image in the final PDF --oversample DPI oversample images to at least the specified DPI, to improve OCR results slightly OCR options: Control how OCR is applied -f, --force-ocr rasterize any fonts or vector objects on each page, apply OCR, and save the rastered output (this rewrites the PDF) -s, --skip-text 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 --skip-big MPixels skip OCR on pages larger than the specified amount of megapixels, but include skipped pages in final output Advanced: Advanced options for power users --tesseract-config CFG additional Tesseract configuration files --tesseract-pagesegmode PSM set Tesseract page segmentation mode (see tesseract --help) --pdf-renderer {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 --pdf-renderer tesseract. --tesseract-timeout SECONDS give up on OCR after the timeout, but copy the preprocessed page into the final output --rotate-pages-threshold CONFIDENCE only rotate pages when confidence is above this value (arbitrary units reported by tesseract) Debugging: Arguments to help with troubleshooting and debugging -k, --keep-temporary-files keep temporary files (helpful for debugging) -g, --debug-rendering render each page twice with debug information on second page 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. 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. 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 --skip-text to ignore pages with text, or --force-ocr to rasterize all objects on the page and produce an image-only PDF as output. ocrmypdf --skip-text file_with_some_text_pages.pdf output.pdf ocrmypdf --force-ocr word_document.pdf output.pdf If you are concerned about long-term archiving of PDFs, use the default option --output-type 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 --output-type pdf. 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. 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. img2pdf --pagesize A4 page*.png | ocrmypdf - myfile.pdf HTML documentation is located at: /usr/share/doc/ocrmypdf/html/index.html after installing the ocrmypdf-doc package.
Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.
Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.
Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.
Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.
The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.
Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.
Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.
Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.