diff --git a/src/calibre/ebooks/conversion/preprocess.py b/src/calibre/ebooks/conversion/preprocess.py
index 82637016cc..43bb52b8ad 100644
--- a/src/calibre/ebooks/conversion/preprocess.py
+++ b/src/calibre/ebooks/conversion/preprocess.py
@@ -42,7 +42,9 @@ def line_length(raw, percent):
'''
raw is the raw text to find the line length to use for wrapping.
percentage is a decimal number, 0 - 1 which is used to determine
- how far in the list of line lengths to use.
+ how far in the list of line lengths to use. The list of line lengths is
+ ordered smallest to larged and does not include duplicates. 0.5 is the
+ median value.
'''
raw = raw.replace(' ', ' ')
linere = re.compile('(?<=
).*?(?=
)', re.DOTALL)
diff --git a/src/calibre/ebooks/pdf/input.py b/src/calibre/ebooks/pdf/input.py
index 08bc1560a3..3b82becc1f 100644
--- a/src/calibre/ebooks/pdf/input.py
+++ b/src/calibre/ebooks/pdf/input.py
@@ -21,7 +21,9 @@ class PDFInput(InputFormatPlugin):
OptionRecommendation(name='no_images', recommended_value=False,
help=_('Do not extract images from the document')),
OptionRecommendation(name='pdf_line_length', recommended_value=0.5,
- help=_('Average line length for line breaking')),
+ help=_('Scale used to determine the length at which a line should '
+ 'be unwrapped. Valid values are a decimal between 0 and 1. The '
+ 'default is 0.5, this is the median line length.')),
])
def convert(self, stream, options, file_ext, log,
@@ -41,7 +43,7 @@ def convert(self, stream, options, file_ext, log,
images.remove('index.html')
for i in images:
# Remove the - from the file name because it causes problems.
- # The referenec to the image with the - will be changed to not
+ # The reference to the image with the - will be changed to not
# include it later in the conversion process.
new_i = i.replace('-', '')
os.rename(i, new_i)
diff --git a/src/calibre/gui2/convert/pdb_output.py b/src/calibre/gui2/convert/pdb_output.py
index 57bf218d33..959078ad97 100644
--- a/src/calibre/gui2/convert/pdb_output.py
+++ b/src/calibre/gui2/convert/pdb_output.py
@@ -30,5 +30,6 @@ def __init__(self, parent, get_option, get_help, db=None, book_id=None):
self.opt_format.setModel(self.format_model)
default_index = self.opt_format.findText(default)
- self.opt_format.setCurrentIndex(default_index if default_index != -1 else 0)
+ format_index = self.opt_format.findText('doc')
+ self.opt_format.setCurrentIndex(default_index if default_index != -1 else format_index if format_index != -1 else 0)
diff --git a/src/calibre/gui2/convert/pdf_input.py b/src/calibre/gui2/convert/pdf_input.py
new file mode 100644
index 0000000000..71e4bc0ef3
--- /dev/null
+++ b/src/calibre/gui2/convert/pdf_input.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+
+__license__ = 'GPL 3'
+__copyright__ = '2009, John Schember '
+__docformat__ = 'restructuredtext en'
+
+from calibre.gui2.convert.pdf_input_ui import Ui_Form
+from calibre.gui2.convert import Widget
+
+class PluginWidget(Widget, Ui_Form):
+
+ TITLE = _('PDF Input')
+ HELP = _('Options specific to')+' PDF '+_('input')
+
+ def __init__(self, parent, get_option, get_help, db=None, book_id=None):
+ Widget.__init__(self, parent, 'pdf_input',
+ ['no_images', 'pdf_line_length'])
+ self.db, self.book_id = db, book_id
+ self.initialize_options(get_option, get_help, db, book_id)
diff --git a/src/calibre/gui2/convert/pdf_input.ui b/src/calibre/gui2/convert/pdf_input.ui
new file mode 100644
index 0000000000..35b840ded0
--- /dev/null
+++ b/src/calibre/gui2/convert/pdf_input.ui
@@ -0,0 +1,61 @@
+
+
+ Form
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+ -
+
+
+ Line Un-Wrapping Factor:
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 213
+
+
+
+
+ -
+
+
+ 1.000000000000000
+
+
+ 0.010000000000000
+
+
+ 0.500000000000000
+
+
+
+ -
+
+
+ No Images
+
+
+
+
+
+
+
+
diff --git a/src/calibre/gui2/convert/pdf_output.py b/src/calibre/gui2/convert/pdf_output.py
index 99fb817cfc..0c63085991 100644
--- a/src/calibre/gui2/convert/pdf_output.py
+++ b/src/calibre/gui2/convert/pdf_output.py
@@ -31,8 +31,9 @@ def __init__(self, parent, get_option, get_help, db=None, book_id=None):
self.paper_size_model = paper_size_model
self.opt_paper_size.setModel(self.paper_size_model)
- default_index = self.opt_paper_size.findText(default_paper_size)
- self.opt_paper_size.setCurrentIndex(default_index if default_index != -1 else 0)
+ default_paper_size_index = self.opt_paper_size.findText(default_paper_size)
+ letter_index = self.opt_paper_size.findText('letter')
+ self.opt_paper_size.setCurrentIndex(default_paper_size_index if default_paper_size_index != -1 else letter_index if letter_index != -1 else 0)
global orientation_model
if orientation_model is None:
@@ -40,6 +41,7 @@ def __init__(self, parent, get_option, get_help, db=None, book_id=None):
self.orientation_model = orientation_model
self.opt_orientation.setModel(self.orientation_model)
- default_index = self.opt_orientation.findText(default_orientation)
- self.opt_orientation.setCurrentIndex(default_index if default_index != -1 else 0)
+ default_orientation_index = self.opt_orientation.findText(default_orientation)
+ orientation_index = self.opt_orientation.findText('portrait')
+ self.opt_orientation.setCurrentIndex(default_orientation_index if default_orientation_index != -1 else orientation_index if orientation_index != -1 else 0)