04-28-2009, 06:39 AM | #1 |
Enthusiast
Posts: 42
Karma: 12
Join Date: Feb 2008
Device: CyBook, Sony PRS 600
|
How to include a pdf crop plugin.
Hello all,
I have made several python scipts for my Cybook G3 device to deal with PDF format. I think I have done quite a lot of experimentations so that I would like to contribute my experience as several plugins. The difficulty is that what I want to do does not quite fit into the design philosophy of the calibre that ANTHING -> HTML -> ANTHING ELSE. I would like to include the following: 1. Crop the pdf document margins to fit better to the reading device. 2. Split multi-column pdf document. 3. Convert PDF pages into images and compile the images again into a PDF file. This is due to the limited implementation of PDF format on many reading devices. If the PDF file contaims too many complicated designs the reading device would crash. However one can always "render" the PDF on the computer as images and make the PDF pages readable. 4. Convert Djvu into PDF. Basically the pages in Djvu format can also be treated as images, and compile again as pdf. All of these conversions does not and should avoid the conversion to HTML in between. Basically I have already make several python scripts to do all those job. Could anyone give me some directions how could I start? Thanks! |
04-28-2009, 07:52 AM | #2 |
creator of calibre
Posts: 44,515
Karma: 24495784
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You're in luck, the new calibre conversion framework has support for two conversion paths:
1) input format -> html -> output format 2) input format -> sequence of images -> output format (2) is already being used for conversion of comics (.cbr and .cbz). It can be used for image based converters of PDF and DJVU as well. The first step is getting the new code running. You can check out the code using the command (in a unix OS) bzr branch lp:~kovid/calibre/pluginize Then run python setup.py build python setup.py develop Now you can use the ebook-convert input-ebook output-ebook command to run the new conversion pipeline. Take a look at the python module calibre.ebooks.comic.input to see how to write an input plugin for an image based format. There is already a plugin for PDF, you can add options to it so that the user can select image based conversion instead of the default HTML based conversion. If you need more help you can ask in the #calibre IRC channel on freenode, mail to the calibre-devs mailling list or just post here. |
04-28-2009, 08:02 AM | #3 | ||||||
Sigil & calibre developer
Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
||||||
04-28-2009, 09:35 AM | #4 | |
Enthusiast
Posts: 42
Karma: 12
Join Date: Feb 2008
Device: CyBook, Sony PRS 600
|
Quote:
There is a dirty way to do this. One can duplicate the page with multiple columns and create multiple pages out of this with the crop tools in 1. This works, although the final pdf file will be several times lager. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to Crop Double Page PDF Files? | picardo | 14 | 12-25-2010 02:07 PM | |
Crop PDF page margins with Skim | Juggle4Evr | Sony Reader | 8 | 03-30-2009 03:12 PM |
Removing print crop from PDF | royboy99 | Sony Reader | 3 | 03-27-2009 10:15 AM |
pdf crop linux | x3oo | 2 | 03-08-2009 07:50 AM | |
Crop PDF. | astra | 2 | 02-01-2009 05:03 PM |