From 2b82c31b85f422dba502fe54198306514065106d Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Tue, 18 Apr 2017 18:07:19 -0700 Subject: [PATCH] Update documentation --- docs/introduction.rst | 27 ++++++++++++++++++++++++++- docs/security.rst | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/docs/introduction.rst b/docs/introduction.rst index 2f9056a4..4ba9a59c 100644 --- a/docs/introduction.rst +++ b/docs/introduction.rst @@ -53,6 +53,20 @@ By default, OCRmyPDF will convert the file to a PDF/A. This behavior can be dis Depending on the settings selected, OCRmyPDF may "graft" the OCR layer into the existing PDF, or reconstruct a visually equivalent new PDF. +Why you shouldn't do this manually +---------------------------------- + +There are two routes to manually applying OCR to an existing PDF, both of which destroy information in the original PDF. + +1. Rasterize each page as an image, OCR the images, and combine the output into a PDF. This preserves the appearance of each page, but resamples all images (possibly losing quality, increasing file size, introducing compression artifacts, etc.) + +2. Extract each image, OCR, and combine the output into a PDF. This loses the context in which images are used in the PDF, meaning that cropping, rotation and scaling of pages may be lost. Some PDFs use multiple images per page with stencil masks, which would quite difficult to reassemble correctly. This also loses and text or vector art on any pages in a PDF with both scanned and pure digital content. + +In the case of a PDF that is nothing other than a container of images (no rotation, scaling, cropping, one image per page), the second approach is can be lossless. + +OCRmyPDF uses several strategies depending on input options and the input PDF itself, but generally speaking it rasterizes a page for OCR and then grafts the OCR back onto the original. As such it can handle complex PDFs and still preserve their contents as much as possible. + + Limitations ----------- @@ -73,4 +87,15 @@ Ghostscript also imposes some limitations: * PDFs containing JBIG2-encoded content will be converted to CCITT Group4 encoding, which has lower compression ratios, if Ghostscript PDF/A is enabled. -OCRmyPDF is currently not designed to be used as a Python API; it is designed to be run as a command line tool. ``import ocrmypf`` currently attempts to process the command line on ``sys.argv`` at import time so it has side effects that will interfere with its use as a package. The API it presents should not be considered stable. \ No newline at end of file +OCRmyPDF is currently not designed to be used as a Python API; it is designed to be run as a command line tool. ``import ocrmypf`` currently attempts to process the command line on ``sys.argv`` at import time so it has side effects that will interfere with its use as a package. The API it presents should not be considered stable. + + +Similar programs +---------------- + +To the author's knowledge, OCRmyPDF is the most feature-rich and thoroughly tested command line OCR PDF conversion tool. If it doesn't meet your needs, consider of these similar open source programs: + +* pdf2pdfocr +* pdfsandwich +* pypdfocr +* pdfbeads \ No newline at end of file diff --git a/docs/security.rst b/docs/security.rst index b42a9ae2..5f4a214a 100644 --- a/docs/security.rst +++ b/docs/security.rst @@ -1,4 +1,4 @@ -PDF Security Issues +PDF security issues =================== OCRmyPDF should only be used on PDFs you trust. It is not designed to protect you against malware.