From 8e1c1890d76647a020983e57d3610a734cad80f9 Mon Sep 17 00:00:00 2001 From: Niremizov Date: Thu, 5 Sep 2024 00:12:30 +0300 Subject: [PATCH] Added supported for CLI margins option. --- camelot/cli.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/camelot/cli.py b/camelot/cli.py index e45664c1..18a22c7c 100644 --- a/camelot/cli.py +++ b/camelot/cli.py @@ -284,6 +284,13 @@ def stream(c, *args, **kwargs): columns = list(kwargs["columns"]) kwargs["columns"] = None if not columns else columns + margins = conf.pop('margins') + + if margins is None: + layout_kwargs = {} + else: + layout_kwargs = {"char_margin": margins[0], "line_margin": margins[1], "word_margin": margins[2]} + if plot_type is not None: if not _HAS_MPL: raise ImportError("matplotlib is required for plotting.") @@ -294,7 +301,7 @@ def stream(c, *args, **kwargs): raise click.UsageError("Please specify output file format using --format") tables = read_pdf( - filepath, pages=pages, flavor="stream", suppress_stdout=quiet, **kwargs + filepath, pages=pages, flavor="stream", suppress_stdout=quiet, layout_kwargs=layout_kwargs, **kwargs ) click.echo(f"Found {tables.n} tables") if plot_type is not None: