diff --git a/src/calibre/ebooks/epub/__init__.py b/src/calibre/ebooks/epub/__init__.py
index f1a60ab646..d8d4c9a758 100644
--- a/src/calibre/ebooks/epub/__init__.py
+++ b/src/calibre/ebooks/epub/__init__.py
@@ -122,7 +122,8 @@ help on using this feature.
structure('prefer_metadata_cover', ['--prefer-metadata-cover'], default=False,
action='store_true',
help=_('Use the cover detected from the source file in preference to the specified cover.'))
-
+ structure('dont_split_on_page_breaks', ['--dont-split-on-page-breaks'], default=False,
+ help=_('Turn off splitting at page breaks. Normally, input files are automatically split at every page break into two files. This gives an output ebook that can be parsed faster and with less resources. However, splitting is slow and if your source file contains a very large number of page breaks, you should turn off splitting on page breaks.'))
toc = c.add_group('toc',
_('''\
Control the automatic generation of a Table of Contents. If an OPF file is detected
diff --git a/src/calibre/ebooks/epub/split.py b/src/calibre/ebooks/epub/split.py
index ed2a78826f..ca95f4094d 100644
--- a/src/calibre/ebooks/epub/split.py
+++ b/src/calibre/ebooks/epub/split.py
@@ -50,11 +50,15 @@ class Splitter(LoggingInterface):
self.split_size = 0
# Split on page breaks
- self.log_info('\tSplitting on page breaks...')
- if self.path in stylesheet_map:
- self.find_page_breaks(stylesheet_map[self.path], root)
- self.split_on_page_breaks(root.getroottree())
- trees = list(self.trees)
+ if not opts.dont_split_on_page_breaks:
+ self.log_info('\tSplitting on page breaks...')
+ if self.path in stylesheet_map:
+ self.find_page_breaks(stylesheet_map[self.path], root)
+ self.split_on_page_breaks(root.getroottree())
+ trees = list(self.trees)
+ else:
+ self.trees = [root.getroottree()]
+ trees = list(self.trees)
# Split any remaining over-sized trees
if self.opts.profile.flow_size < sys.maxint:
diff --git a/src/calibre/gui2/dialogs/epub.ui b/src/calibre/gui2/dialogs/epub.ui
index 871a401fbb..f19ed7ed1a 100644
--- a/src/calibre/gui2/dialogs/epub.ui
+++ b/src/calibre/gui2/dialogs/epub.ui
@@ -77,7 +77,7 @@
-
- 3
+ 0
@@ -89,6 +89,36 @@
Book Cover
+
-
+
+
-
+
+
+
+
+
+ :/images/book.svg
+
+
+ true
+
+
+ Qt::AlignCenter
+
+
+
+
+
+ -
+
+
+ Use cover from &source file
+
+
+ true
+
+
+
-
@@ -140,36 +170,6 @@
- -
-
-
- Use cover from &source file
-
-
- true
-
-
-
- -
-
-
-
-
-
-
-
-
- :/images/book.svg
-
-
- true
-
-
- Qt::AlignCenter
-
-
-
-
-
opt_prefer_metadata_cover
@@ -586,6 +586,13 @@
+ -
+
+
+ Do not &split on page breaks
+
+
+