Skip to content

Commit

Permalink
Added supported for CLI margins option.
Browse files Browse the repository at this point in the history
  • Loading branch information
Niremizov-Omcode committed Sep 4, 2024
1 parent 5c23e10 commit 8e1c189
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion camelot/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand All @@ -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:
Expand Down

0 comments on commit 8e1c189

Please sign in to comment.