View Single Post
Old 02-15-2010, 11:41 PM   #10
frabjous
Wizard
frabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
frabjous's Avatar
 
Posts: 1,213
Karma: 12890
Join Date: Feb 2009
Location: Amherst, Massachusetts, USA
Device: Sony PRS-505
Quote:
Probably you can do that with Windows too, but I don't really have experience with ghostscript for Windows.
OK, it took awhile, since ghostscript works a bit different for Windows, but this seems to work.

Here's what you'd need to do.

1. Install both Calibre and Ghostscript.

2. Copy and paste the following in to Notepad.

Quote:
for %%I in (*.pdf) do (
"C:\Program Files\gs\gs8.64\bin\gswin32c.exe" -dSAFER -dNOPAUSE -sDEVICE#bbox "%%I" 2> bounding
"C:\Program Files (x86)\Calibre2\pdfmanipulate.exe" crop -o "%%~nI-cropped.pdf" -b bounding "%%I"
)
3. Double check that the paths on your computer to pdfmanipulate.exe and gswin32c.exe are right. If you're using a 32 bit version of Windows, rather than a 64 bit version of Windows, you may need to change "C:\Progam Files (x86)\..." to just "C:\Program Files\". If you're using a newer or older version of ghost script, you may need to change "gs8.64" to something else, and so on.

4. Save the file as something ending in .bat, such as "multicrop.bat", and save it in the same directory as the PDFs you want to crop.

5. Open the folder in question in Windows Explorer or "My Computer" and double click on "multicrop[.bat]", and it should crop all the PDFs in that folder automatically.

(Please back-up all files before trying this and don't blame me too much if things go awry.)

Let me know how this works for you, and if the script needs tweaking.
frabjous is offline   Reply With Quote