# `crop`
Crop pages to a rectangle
## Usage
> pdftl `` `crop` `...` `[preview]` `output` `` `[]`
## Details
Crops pages to a rectangle defined by offsets from the edges or in
various other ways.
One format is `page-range(left[,top[,right[,bottom]]])`. Here, `left`,
`top` etc. are offsets from the current page boundaries; positive numbers
move inwards towards the center of the page. If you omit some of
these, the rest are filled in in the obvious way. Units can be `pt`
(points), `in` (inches), `mm`, `cm` or `%` (a percentage). If omitted,
the default unit is `pt`.
For example, `1-end(10pt,20pt,10pt,20pt)` removes a
margin of 10 points from the left and right, and
20 points from the top and bottom.
Alternatively, specify `1-3(a4)` to crop pages `1-3` to size a4.
Many paper size names are allowed, see `data/paper_sizes.py`.
For landscape add the suffix `_l` to the paper size, e.g., `a4_l`.
You can also crop to the visible content using `fit`:
- `1-end(fit)` or simply '(fit)' crops each page to its content.
- `1-10(fit-group)` crops pages 1-10 to the union of their content.
- `1-10(fit-group=2-3)` crops pages 1-10 to the union of the contents of pages 2-3.
Or use `abs` to specify an exact bounding box `x0,y0,x1,y1` where
`x0,y0` are the coordinates of the bottom left corner and `x1,y1` the
coordinates of the upper right corner:
- `1-10(abs,100,150,400,500)` crops pages 1-10 to the absolutely
positioned box with corners at (100pt,150pt) and (400pt,500pt)
You can also include a comma-separated list of up to 4 dimensions to
expand the crop rectangle: `(fit,1cm)` or `(fit-group, 10,0,20,50)`.
When using `abs` you can also give units or percentages, or just
numbers to default to `pt`. This uses the PDF page coordinate system,
so x-values increase to the right and y-values increase
upwards. Often, but not always, the origin (0,0) is at the bottom left
corner of the page (this depends on the page MediaBox, as shown by
`dump_data`, for example.)
If the `preview` keyword is given, a rectangle will be drawn instead
of cropping.
## Examples
> Remove a 1cm margin from the sides
and 2cm from the top and bottom of all pages:
```
pdftl in.pdf crop '1-end(1cm,2cm)' output out.pdf
```
> Crop every page to its visible content plus 10pt padding.
```
pdftl in.pdf crop '1-end(fit,10pt)' output clean.pdf
```
> Preview effect of cropping the even-numbered pages
between pages 2 and 8 to A5
```
pdftl in.pdf crop '2-8even(a5)' preview output out.pdf
```
**Tags**: in_place, geometry
*Source: pdftl.operations.rebox*
*Read online: [https://pdftl.readthedocs.io/en/stable/operations/crop.html](https://pdftl.readthedocs.io/en/stable/operations/crop.html)*
*Type: Operation*