Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we have exclude box in Page.Crop functionality #369

Closed
sreeni5493 opened this issue Mar 8, 2021 · 2 comments
Closed

Can we have exclude box in Page.Crop functionality #369

sreeni5493 opened this issue Mar 8, 2021 · 2 comments
Assignees
Labels
feature-request All feature requests receive this label initially, can be upgraded to "enhancement"

Comments

@sreeni5493
Copy link

To exclude a list of boxes based on bounding box locations.

Also can Page Crop have capabilities to include multiple bbox to crop multiple areas. For including it is fine since we can run a for loop and get text inside mulitple crop box. But for excluding, this technique wont work.

@sreeni5493 sreeni5493 added the feature-request All feature requests receive this label initially, can be upgraded to "enhancement" label Mar 8, 2021
@jsvine jsvine self-assigned this Mar 13, 2021
@jsvine
Copy link
Owner

jsvine commented Mar 13, 2021

Hi @sreeni5493, I agree: I think that could be a useful feature. Thanks for the suggestion. Adding it to my to-do list.

jsvine added a commit that referenced this issue Jul 20, 2022
@jsvine
Copy link
Owner

jsvine commented Jul 20, 2022

You can now call Page.outside_bbox(...): https://github.com/jsvine/pdfplumber/releases/tag/v0.7.4

If you have multiple bounding boxes you want to exclude, you can chain calls to .outside_bbox(...) or loop through them. E.g.,:

page = pdf.pages[0]
bboxes = [ bbox_0, bbox_1, bbox_2 ]
for bbox in bboxes:
  page = page.outside_bbox(bbox)

@jsvine jsvine closed this as completed Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request All feature requests receive this label initially, can be upgraded to "enhancement"
Projects
None yet
Development

No branches or pull requests

2 participants