__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import glob
import os
from calibre.customize.conversion import OutputFormatPlugin, OptionRecommendation
from calibre.ebooks.metadata.opf2 import OPF
from calibre.ptempfile import TemporaryDirectory
from calibre.ebooks.pdf.writer import PDFWriter, ImagePDFWriter, PDFMetadata
from calibre.ebooks.pdf.pageoptions import UNITS, PAPER_SIZES, ORIENTATIONS
class PDFOutput(OutputFormatPlugin):
name = 'PDF Output'
author = 'John Schember and Kovid Goyal'
file_type = 'pdf'
options = set([
OptionRecommendation(name = 'unit', recommended_value = 'inch', level = OptionRecommendation.LOW, short_switch = 'u', choices = UNITS.keys(), help = _('The unit of measure. Default is inch. Choices are %s Note: This does not override the unit for margins!') % UNITS.keys()),
OptionRecommendation(name = 'paper_size', recommended_value = 'letter', level = OptionRecommendation.LOW, choices = PAPER_SIZES.keys(), help = _('The size of the paper. This size will be overridden when an output profile is used. Default is letter. Choices are %s') % PAPER_SIZES.keys()),
OptionRecommendation(name = 'custom_size', recommended_value = None, help = _('Custom size of the document. Use the form widthxheight EG. `123x321` to specify the width and height. This overrides any specified paper-size.')),
OptionRecommendation(name = 'orientation', recommended_value = 'portrait', level = OptionRecommendation.LOW, choices = ORIENTATIONS.keys(), help = _('The orientation of the page. Default is portrait. Choices are %s') % ORIENTATIONS.keys()),
OptionRecommendation(name = 'preserve_cover_aspect_ratio', recommended_value = False, help = _('Preserve the aspect ratio of the cover, instead of stretching it to fill the ull first page of the generated pdf.'))])