From 1950acfbda3a659ca70658c848f900306ab2e35e Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Sun, 20 Feb 2022 00:56:43 -0800 Subject: [PATCH] docs: proofread plugins --- docs/plugins.rst | 10 ++++++++++ src/ocrmypdf/pluginspec.py | 8 ++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/plugins.rst b/docs/plugins.rst index c8d3e5ae..1d8f3f70 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -152,6 +152,16 @@ hooks. As such, you cannot "chain" a series of plugin filters together in this way. Instead, a single hook implementation should be responsible for any such chaining operations. +Examples +======== + +* OCRmyPDF's test suite contains several plugins that are used to simulate certain + test conditions. +* `ocrmypdf-papermerge `_ is + a production plugin that integrates OCRmyPDF and the Papermerge document + management system. + + Custom command line arguments ----------------------------- diff --git a/src/ocrmypdf/pluginspec.py b/src/ocrmypdf/pluginspec.py index bec8bcba..9db079e2 100644 --- a/src/ocrmypdf/pluginspec.py +++ b/src/ocrmypdf/pluginspec.py @@ -132,6 +132,7 @@ def get_progressbar_class(): Here is how OCRmyPDF will use the progress bar: Example: + pbar_class = pm.hook.get_progressbar_class() with pbar_class(**tqdm_kwargs) as pbar: ... @@ -235,9 +236,9 @@ def filter_page_image(page: 'PageContext', image_filename: Path) -> Path: ``image_filename``. The hook may overwrite ``image_filename`` with a new file. The output image should preserve the same physical unit dimensions, that is - (width * dpi_x, height * dpi_y). That is, if the image is resized, the DPI + ``(width * dpi_x, height * dpi_y)``. That is, if the image is resized, the DPI must be adjusted by the reciprocal. If this is not preserved, the PDF page - will be resized and the OCR layer misaligned. OCRmyPDF does not nothing + will be resized and the OCR layer misaligned. OCRmyPDF does nothing to enforce these constraints; it is up to the plugin to do sensible things. OCRmyPDF will create the PDF page based on the image format used (unless the @@ -399,8 +400,7 @@ def get_ocr_engine() -> OcrEngine: """Returns an OcrEngine to use for processing this file. The OcrEngine may be instantiated multiple times, by both the main process - and child process. As such, it must be obtain store any state in ``options`` - or some common location. + and child process. Note: This is a :ref:`firstresult hook`.