Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > PDF

Notices

Reply
 
Thread Tools Search this Thread
Old 01-10-2009, 05:05 PM   #1
moggie
Enthusiast
moggie is on a distinguished road
 
moggie's Avatar
 
Posts: 34
Karma: 74
Join Date: Nov 2008
Location: Cambridge,UK
Device: sony 505
yet another cropping tool

I recently sent kovid a set of patches which implemented a cropping tool for pdf's for the command line. It was released in yesterdays version Version 0.4.127. Basically you can use it to reduce the page by a set amount or use the output of ghostscript to automatically crop pages.

The usage is :

Code:
pdftrim --help
Usage: pdftrim.py [options] file.pdf

Crops a pdf. 


Whenever you pass arguments to pdftrim.py that have spaces in them, enclose the arguments in quotation marks.

Options:
  --version             show program's version number and exit

  -h, --help            show this help message and exit

  --verbose             Be verbose, useful for debugging. Can be specified
                        multiple times for greater verbosity.

  -o OUTPUT, --output=OUTPUT
                        Path to output file. By default a file is created in
                        the current directory.

  -x BOTTOM_LEFT_X, --leftx=BOTTOM_LEFT_X
                        Number of pixels to crop from the left most x (default
                        is 10)

  -y BOTTOM_LEFT_Y, --lefty=BOTTOM_LEFT_Y
                        Number of pixels to crop from the left most y (default
                        is 10)

  -v TOP_RIGHT_X, --rightx=TOP_RIGHT_X
                        Number of pixels to crop from the right most x
                        (default is 10)

  -w TOP_RIGHT_Y, --righty=TOP_RIGHT_Y
                        Number of pixels to crop from the right most y
                        (default is 10)

  -b BOUNDING, --bounding=BOUNDING
                        A file generated by ghostscript which allows each page
                        to be individually cropped [gs -dSAFER -dNOPAUSE
                        -dBATCH -sDEVICE=bbox > bounding]
Like all of calibre it is free under the gpl. As its part of calibre its not going to get horribly complicated but I hope it will be usefull
moggie is offline   Reply With Quote
Old 01-14-2009, 08:13 AM   #2
alexxxm
Addict
alexxxm has a complete set of Star Wars action figures.alexxxm has a complete set of Star Wars action figures.alexxxm has a complete set of Star Wars action figures.alexxxm has a complete set of Star Wars action figures.
 
Posts: 205
Karma: 356
Join Date: Aug 2007
Device: Rocket; Hiebook; N700; Sony 505; Kindle DX ...
Thank you for your useful tool, it arrives at the right time - I need to trim out a "slice" from each page of a book I scanned.

I got the tool from the latest calibre install, so I don't know if the problem comes from the tool itself or from calibre, anyway here is the output:

> pdftrim -x 100 "Marazzini - La rilegatura artigianale e d'arte.pdf"

Traceback (most recent call last):
File "/usr/bin/pdftrim", line 8, in <module>
load_entry_point('calibre==0.4.127', 'console_scripts', 'pdftrim')()
File "build/bdist.linux-i686/egg/calibre/ebooks/pdf/pdftrim.py", line 56, in main
AttributeError: 'NoneType' object has no attribute 'title'


not knowing python, it's hard for me to decode the error...

thanks for any help!

alessandro
alexxxm is offline   Reply With Quote
 
Advertisement
Old 01-14-2009, 02:07 PM   #3
moggie
Enthusiast
moggie is on a distinguished road
 
moggie's Avatar
 
Posts: 34
Karma: 74
Join Date: Nov 2008
Location: Cambridge,UK
Device: sony 505
Quote:
Originally Posted by alexxxm View Post
Thank you for your useful tool, it arrives at the right time - I need to trim out a "slice" from each page of a book I scanned.

I got the tool from the latest calibre install, so I don't know if the problem comes from the tool itself or from calibre, anyway here is the output:

> pdftrim -x 100 "Marazzini - La rilegatura artigianale e d'arte.pdf"

not knowing python, it's hard for me to decode the error...

thanks for any help!

I have logged a ticket

alessandro
I know what the problem is, so I will send a patch to kovid tonight and knowing him it will be out in the next patch.

If you can set a title and author on the source pdf that will probably fix the problem now.


http://calibre.kovidgoyal.net/ticket/1617

Last edited by moggie; 01-14-2009 at 04:22 PM. Reason: adding ticket number
moggie is offline   Reply With Quote
Old 01-14-2009, 05:10 PM   #4
moggie
Enthusiast
moggie is on a distinguished road
 
moggie's Avatar
 
Posts: 34
Karma: 74
Join Date: Nov 2008
Location: Cambridge,UK
Device: sony 505
Quote:
Originally Posted by moggie View Post
I know what the problem is, so I will send a patch to kovid tonight and knowing him it will be out in the next patch.

If you can set a title and author on the source pdf that will probably fix the problem now.

http://calibre.kovidgoyal.net/ticket/1617
I think I have fixed it in the next release, as kovid has commited the patch. If you want me to test it, attach the file to this thread.
moggie is offline   Reply With Quote
Old 01-16-2009, 05:42 AM   #5
alexxxm
Addict
alexxxm has a complete set of Star Wars action figures.alexxxm has a complete set of Star Wars action figures.alexxxm has a complete set of Star Wars action figures.alexxxm has a complete set of Star Wars action figures.
 
Posts: 205
Karma: 356
Join Date: Aug 2007
Device: Rocket; Hiebook; N700; Sony 505; Kindle DX ...
Thank you a lot,
it works flawlessly now.

Alessandro
alexxxm is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cropping Multiple Files SpyKiIIer PDF 16 12-07-2012 01:09 AM
Cropping PDFs harryo iRex 33 11-20-2009 11:41 AM
cropping pdf with preview wang960 Sony Reader 2 05-05-2009 10:28 AM
Yet another PDF cropping tool sjvr767 iRex 7 02-14-2009 08:04 AM
Nice Mac OS X .pdf Cropping Tool jmdor Sony Reader 0 04-04-2007 11:41 PM


All times are GMT -4. The time now is 11:54 PM.


MobileRead.com is a privately owned, operated and funded community.