camelot-dev / camelot-dev/camelot

Specify layout dimensions of page

Open
#226 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
3.8k
Forks
546
Avg merge
3d 17h
Merged PRs (30d)
3

Description

I am using the following script to get the page dimensions from camelot

For one document, layout dimensions came out to be 792, 612 and in another one it came to be 833, 644. Is it possible to specify in camelot that you require the page to be scaled to particular dimensions?

I am asking this because I am using PymuPDF functionality to extract words and their bounding boxes to get the column headers. The coordinates of column headers give me the column boundaries which I want to use in `camelot.read_pdf()` operating on stream mode. Right now, it is becoming difficult to achieve handshake between the two coordinate systems from the two packages. If camelot has a functionality to specify layout dimensions, I can provide the layout of PymuPDF to camelot

![image](https://user-images.githubusercontent.com/13075725/109980975-c2680100-7d00-11eb-9cca-ce1099fdb859.png)

**Steps to reproduce the bug**
Steps used to install `camelot`:
`pip install camelot-py==0.8.2`

**Code**
Add the Camelot code snippet that you used.
```
from camelot import utils

layout, dim = utils.get_page_layout(filename)
page_width = layout.width
page_height = layout.height
print(f"page_width: {page_width}, page_height: {page_height}")
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the mentioned utils.get_page_layout entry point and the stream-mode path in camelot.read_pdf(), then compare their coordinate handling with the PyMuPDF dimensions described in the issue. Done means the requested page-dimension behavior is defined and supported, with tests covering the differing page sizes and coordinate boundaries.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.