View Full Version : Any FREE software to crop PDF pages


droople
04-25-2010, 08:55 AM
Hi

I'm looking for a free software to crop PDF pages.

Any suggestions?

Thank you in advance.

Cheers

frabjous
04-25-2010, 03:00 PM
It might help to know what Operating System you're on, and whether or not you'd be OK with a command line tool.

Anyway, sopdf (http://www.mobileread.com/forums/showthread.php?t=32066) does this, and more (though with the right settings you can get it only to crop). It's very fast too. Calibre, which has its own subforum here, comes with a command line tool for cropping PDFs which you can automate if you combine with ghostscript (also free).

I gave instructions for using these to do batch crops of an entire directory of PDFs here (http://www.mobileread.com/forums/showthread.php?p=790875) and here (http://www.mobileread.com/forums/showthread.php?p=790952#post790952).

Linux also has a GUI-based program called pdfedit (http://pdfedit.petricek.net/en/index.html).

WillAdams
04-25-2010, 03:35 PM
pdftk and multivalent should be able to do this as well.

I usually use pdflatex to crop / tweak .pdfs --- one can also print to a .ps file w/ appropriate page setting and re-distill.

frabjous
04-25-2010, 04:23 PM
Pdftk cannot crop pages as far as I know. If it can, please post the command here. I use pdftk for a lot of things, I've never heard of using for it cropping before.

How does printing to a .ps file help? Please be specific.

We are talking about cropping individual pages here, not removing a page range.

WillAdams
04-25-2010, 05:12 PM
Define a (custom) page size as desired.

Print the .pdf using said page size to a .ps file.

Distill to a pdf

Or use pdfcrop:

http://pdfcrop.sourceforge.net/

Or a script which uses pdftk:

#!/bin/bash

perl -pe "s/(Crop|Media)Box\s*\[(.+?)\]/\$1Box\[$2\]/g;" $1 | pdftk - output $3

(from http://konrad.familie-kieling.de/computer/34-linux/63-crop-pdfs )

frabjous
04-25-2010, 07:39 PM
I use pdflatex to do things like this too, but I don't think pdflatex or perl/python scripts designed for linux are the answer for most users. (Unfortunately, it's not pdftk doing the cropping there, but perl...)

SoPDF is faster than any of those, and runs fine under windows with no dependencies, so that'd be my recommendation unless we've got a mac or linux user here.

droople
04-25-2010, 09:58 PM
It might help to know what Operating System you're on, and whether or not you'd be OK with a command line tool.

Anyway, sopdf (http://www.mobileread.com/forums/showthread.php?t=32066) does this, and more (though with the right settings you can get it only to crop). It's very fast too. Calibre, which has its own subforum here, comes with a command line tool for cropping PDFs which you can automate if you combine with ghostscript (also free).

I gave instructions for using these to do batch crops of an entire directory of PDFs here (http://www.mobileread.com/forums/showthread.php?p=790875) and here (http://www.mobileread.com/forums/showthread.php?p=790952#post790952).

Linux also has a GUI-based program called pdfedit (http://pdfedit.petricek.net/en/index.html).

Thank you frabjous

I'm using WinXP, I'm ok with command line if no other GUI software available.

I'm not sure how to crop pages without seeing the pages?

greenapple
04-25-2010, 10:11 PM
Most PDF editors I know simply change the viewable portion by changing the margin. I haven't come across one that actually crops and discards the unwanted areas. :)

droople
04-25-2010, 10:30 PM
Most PDF editors I know simply change the viewable portion by changing the margin. I haven't come across one that actually crops and discards the unwanted areas. :)

that's good enough for reading on the 6-inch screen

frabjous
04-25-2010, 11:17 PM
Thank you frabjous
I'm not sure how to crop pages without seeing the pages?

The programs I mentioned and linked to will automatically calculate the whitespace and remove all the whitespace possible. If all you're cutting out is whitespace, and you don't want to leave any behind, there shouldn't be an issue.

If you want to leave any whitespace there, or you want to crop out non-empty parts of the page, things get more complicated. I give some input on doing that with calibre's pdfmanipulate program in one of the threads I linked to, but without a GUI you just have to use trial and error, or measure what you need to crop.

SoPDF is a commandline program, but there are two simple GUI wrappers for it for windows. One I wrote, which you'll find you go far enough in the thread. Another Nathan Campos wrote, which you'll find if you search the forums here at Mobileread. His is nice because it shows any errors you get in the window, but mine has some other nice features (though I'm biased). (I don't personally use either, since I don't use Windows anymore.)

If I recall correctly it's the -m3 or "Fit Height" option that will only crop, not split the pages.

There are different levels of "leaving the rest behind" vs. cropping. Adobe Acrobat's cropping feature for example, just inserts a command for hiding portions of the page which is not respected by non-Adobe PDF viewers. The methods I've listed do better than that; they do genuinely resize the page. However, they don't fully remove elements that get cropped out if you're removing more than just whitespace; they just aren't shown. If all you're cropping is whitespace, however, there's no difference.

ab7vf
04-26-2010, 02:11 AM
you might check out "papercrop"

(google is your friend)

Jim

roger64
04-26-2010, 03:07 AM
There are different levels of "leaving the rest behind" vs. cropping. Adobe Acrobat's cropping feature for example, just inserts a command for hiding portions of the page which is not respected by non-Adobe PDF viewers. .

I had the oppportunity to use Adobe Acrobat 7 once. If you select the dedicated option for it, it is able to crop cleanly a pdf book, taking out all whitespace page by page (taking into account that some pages in the book can have a variable text content). It seems the end result is a really cropped pdf. Am I wrong?

This maybe would explain why the display time of this cropped file was soooooo long on my PRS-505.

roger64
04-26-2010, 03:11 AM
mistake

frabjous
04-26-2010, 08:26 AM
you might check out "papercrop"
(google is your friend)


PaperCrop converts the PDF to a .gif sequence of images, which means you lose any ability to use search or dictionary functions with your PDF. It'll also radically increase the size of the file. Still it IS useful for many purposes, especially if you have a multi-column PDF you want to make readable on a 6" screen by splitting the columns.

I had the oppportunity to use Adobe Acrobat 7 once. If you select the dedicated option for it, it is able to crop cleanly a pdf book, taking out all whitespace page by page (taking into account that some pages in the book can have a variable text content). It seems the end result is a really cropped pdf. Am I wrong?

I don't know. I do have a copy of Adobe Acrobat (> 7) but almost never use it; I was mainly going by what others say on these forums. I don't remember a "dedicated" option but perhaps didn't look hard enough.

The PDF reading firmware on the Sony is made by Adobe, so I don't think you could tell testing with it.

roger64
04-26-2010, 09:06 AM
I don't remember a "dedicated" option but perhaps didn't look hard enough.

Well, English is not my native language, as you strongly suspect. Let's try "a special tick-box for removing white space" (see the lower part of the attachment below, a screenshot from Acrobat 7) :p

toscadera
04-26-2010, 10:55 AM
Hello there,

how about cutting a 2-page scanned pdf into two single pages? And then remove the white space? For Mac, no command line, and preferably free :)

cheers
k

frabjous
04-26-2010, 02:26 PM
how about cutting a 2-page scanned pdf into two single pages? And then remove the white space? For Mac, no command line, and preferably free

You don't ask for much, do you?

I think PDFRead (http://www.mobileread.com/forums/showthread.php?t=21906) might be your best bet in this case. But I have little experience with macs.

Well, English is not my native language, as you strongly suspect. Let's try "a special tick-box for removing white space" (see the lower part of the attachment below, a screenshot from Acrobat 7) :p

Yeah, that won't result in a "real" crop, but it'll be fine for the Sony Reader probably. Not a free solution, though.

droople
04-27-2010, 06:52 AM
The programs I mentioned and linked to will automatically calculate the whitespace and remove all the whitespace possible. If all you're cutting out is whitespace, and you don't want to leave any behind, there shouldn't be an issue.

If you want to leave any whitespace there, or you want to crop out non-empty parts of the page, things get more complicated. I give some input on doing that with calibre's pdfmanipulate program in one of the threads I linked to, but without a GUI you just have to use trial and error, or measure what you need to crop.

SoPDF is a commandline program, but there are two simple GUI wrappers for it for windows. One I wrote, which you'll find you go far enough in the thread. Another Nathan Campos wrote, which you'll find if you search the forums here at Mobileread. His is nice because it shows any errors you get in the window, but mine has some other nice features (though I'm biased). (I don't personally use either, since I don't use Windows anymore.)

If I recall correctly it's the -m3 or "Fit Height" option that will only crop, not split the pages.

There are different levels of "leaving the rest behind" vs. cropping. Adobe Acrobat's cropping feature for example, just inserts a command for hiding portions of the page which is not respected by non-Adobe PDF viewers. The methods I've listed do better than that; they do genuinely resize the page. However, they don't fully remove elements that get cropped out if you're removing more than just whitespace; they just aren't shown. If all you're cropping is whitespace, however, there's no difference.

Thank you frabjous

I will looking for GUI wrappers

roger64
04-27-2010, 04:42 PM
Yeah, that won't result in a "real" crop, but it'll be fine for the Sony Reader probably. Not a free solution, though.

Your information above (which is correct) surprised me and at the same time explained why loading a so-called "cropped" page took so long on my Sony, much longer than for an average PDF whose format fits the screen.

Googling around, I read that it is nevertheless possible to "refry" this so-called "cropped" PDF, that is to save it again as a new PDF using Distiller. This time, at least, it will be really and permanently cropped, and so should load much more quickly.
http://www.prepressure.com/pdf/basics/refrying

As I have no experience about it, I will make some trials. It may be that "refry" means only saving to a PS file and back to PDF. It also remains to see if this operation does not damage some characters of the original file.

I wonder if it would not be possible to obtain this "refrying" feature using a free PDF printer.

frabjous
04-27-2010, 05:36 PM
As I have no experience about it, I will make some trials. It may be that "refry" means only saving to a PS file and back to PDF. It also remains to see if this operation does not damage some characters of the original file.

Do some tests and let us know. I gather from what I read on the link you posted that printing to the distiller is in effect the same as converting to PS and then back to PDF, so it doesn't matter which you do. Printing to Distiller sounds easier, assuming it works.

I wonder if it would not be possible to obtain this "refrying" feature using a free PDF printer.

But unless you were using Acrobat itself to do the cropping, why would you need to "refry" it to begin with? And if you have Acrobat installed, then you don't need a free PDF printer, since you have distiller.

Nevertheless, Ghostscript (http://pages.cs.wisc.edu/~ghost/) is certainly capable of converting from PDF to PS and then back again, and it's free software. I've used that as a method of stripping the JavaScript out of a PDF to increase security.

There are also free PDF printers like PDFCreator (http://en.pdfforge.org/pdfcreator). But I think the effects of printing to PDFCreator would depend on what program was doing the printing, and the page settings you picked. Probably printing from Adobe Reader would do the trick—but again, unless you were using the Full Acrobat to do the cropping, why would the PDF need to be refried to begin with?

roger64
04-28-2010, 11:26 AM
I just failed to really crop permanently the file with Acrobat7.

I saved the pseudo cropped PDF file as a ps, used Distiller to create a new PDF out of it with a special page model. No way, I still have lot of whitespace around it.

This does not mean though that it's impossible because I read several pages about it. "Refrying" is said to work for this.

Well, "langue au chat!" :chinscratch:

frabjous
04-28-2010, 11:43 AM
When you printed to distiller, did it have a place to pick the page size?

Anyway, not sure why you're bothering with all this. Wouldn't it just be easier to use soPDF?

roger64
04-28-2010, 12:00 PM
I tried this (see attachment).

Why? Why not? I had a powerful gun and I thought I would easily kill this small rabbit. Well, I failed. Now, I am going to take a hammer...:)

frabjous
04-28-2010, 12:14 PM
Not sure if this is the problem, but the screen size of the 505 is 90 x 120mm, not 125mm x 175mm.

roger64
04-28-2010, 12:49 PM
mistake

roger64
04-28-2010, 12:49 PM
Yes, but I planned to read the book half page by half page in landscape mode; from it: 120mmx175mm

laborg
05-09-2010, 02:13 PM
I wrote a small application which should fit your needs:

http://www.mobileread.com/forums/showthread.php?t=83053