Linux command
pdfcrop 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Automatically detect and remove
pdfcrop [path/to/input_file.pdf] [path/to/output_file.pdf]
Example
pdfcrop [path/to/input_file.pdf] --margins '[left] [top] [right] [bottom]' [path/to/output_file.pdf]
Example
pdfcrop [path/to/input_file.pdf] --margins [300] [path/to/output_file.pdf]
Example
pdfcrop [path/to/input_file.pdf] --bbox '[left] [top] [right] [bottom]' [path/to/output_file.pdf]
Example
pdfcrop [path/to/input_file.pdf] --bbox-odd '[left] [top] [right] [bottom]' --bbox-even '[left] [top] [right] [bottom]' [path/to/output_file.pdf]
Example
pdfcrop [path/to/input_file.pdf] --resolution 72 [path/to/output_file.pdf]
说明
pdfcrop automatically detects and removes margins from PDF pages using Ghostscript for boundary detection and pdfTeX for the actual cropping. It analyzes each page to find the bounding box of actual content and creates a new PDF with minimal whitespace. The tool is particularly useful for preparing scanned documents, removing excess margins from journal articles, or optimizing PDFs for e-reader displays. It can process all pages automatically or apply custom bounding boxes.
参数
- --margins _"l t r b"_
- Add margins after cropping (in bp units)
- --clip
- Clip content to bounding box
- --bbox _"l t r b"_
- Use specified bounding box for all pages
- --bbox-odd _"l t r b"_
- Bounding box for odd pages
- --bbox-even _"l t r b"_
- Bounding box for even pages
- --resolution _dpi_
- Resolution for bounding box detection (default: 72)
- --restricted
- Turn on restricted mode (safer for web use)
- --verbose
- Print additional processing information
- --debug
- Enable debug mode with more output
- --gscmd _command_
- Specify Ghostscript command to use
- --pdftexcmd _command_
- Specify pdftex command to use
- --help
- Display help message
- --version
- Display version information
FAQ
What is the pdfcrop command used for?
pdfcrop automatically detects and removes margins from PDF pages using Ghostscript for boundary detection and pdfTeX for the actual cropping. It analyzes each page to find the bounding box of actual content and creates a new PDF with minimal whitespace. The tool is particularly useful for preparing scanned documents, removing excess margins from journal articles, or optimizing PDFs for e-reader displays. It can process all pages automatically or apply custom bounding boxes.
How do I run a basic pdfcrop example?
Run `pdfcrop [path/to/input_file.pdf] [path/to/output_file.pdf]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --margins _"l t r b"_ do in pdfcrop?
Add margins after cropping (in bp units)