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 @@ class PDFInput(InputFormatPlugin):
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 @@ class PluginWidget(Widget, Ui_Form):
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_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 @@ class PluginWidget(Widget, Ui_Form):
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 @@ class PluginWidget(Widget, Ui_Form):
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)