This commit is contained in:
Kovid Goyal 2009-04-26 23:00:47 -07:00
parent 3938bbdaeb
commit 0749f44979
4 changed files with 42 additions and 26 deletions

View File

@ -133,6 +133,14 @@ class InputFormatPlugin(Plugin):
#: (option_name, recommended_value, recommendation_level)
recommendations = set([])
def get_images(self):
'''
Return a list of absolute paths to the images, if this input plugin
represents an image collection. The list of images is in the same order
as the spine and the TOC.
'''
raise NotImplementedError()
def convert(self, stream, options, file_ext, log, accelerators):
'''
This method must be implemented in sub-classes. It must return

View File

@ -357,6 +357,9 @@ class ComicInput(InputFormatPlugin):
thumbnail = None
return new_pages
def get_images(self):
return self._images
def convert(self, stream, opts, file_ext, log, accelerators,
progress=lambda p, m : m):
from calibre.ebooks.metadata import MetaInformation
@ -401,6 +404,9 @@ class ComicInput(InputFormatPlugin):
spine = []
for comic in comics:
spine.extend(map(href, comic[2]))
self._images = []
for comic in comics:
self._images.extend(comic[1])
opf.create_spine(spine)
toc = TOC()
if len(comics) == 1:

View File

@ -60,6 +60,9 @@ class PDFOutput(OutputFormatPlugin):
])
def convert(self, oeb_book, output_path, input_plugin, opts, log):
self.opts, self.log = opts, log
if input_plugin.is_image_collection:
self.convert_images(input_plugin.get_images())
with TemporaryDirectory('_pdf_out') as oebdir:
OEBOutput(None).convert(oeb_book, oebdir, input_plugin, opts, log)

View File

@ -9,10 +9,9 @@ __docformat__ = 'restructuredtext en'
Write content to PDF.
'''
import os, shutil, sys
import os, shutil
from calibre.ptempfile import PersistentTemporaryDirectory
from calibre.customize.profiles import OutputProfile
from calibre.ebooks.pdf.pageoptions import unit, paper_size, \
orientation, size
from calibre.ebooks.metadata import authors_to_string