A software called pdfcrop (I think it is in the Ubuntu repositories) can do this. From a console the syntax is the following:
pdfcrop input.pdf output.pdf
I wanted to use this feature from my file browser (Nautilus), by right-clicking the file-to-be-cropped and choosing "Scripts -> Crop PDF". Here is how to do this:
- Create a file called CropPDF located at ~/.gnome2/nautilus-scripts with the following content
#!/bin/bash pdfcrop $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS \ $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
Caution: this modifies the file, on which you execute the operation!
Nice tip. Here is a small improvement if you want to be able to convert multiple files at a time:
ReplyDelete#!/bin/bash
echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | while read filename; do
if [ "$filename" != "" ]; then
pdfcrop "$filename" "$filename"
fi
done
If you use cinnamon and nemo, replace $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS with $NEMO_SCRIPT_SELECTED_FILE_PATHS