From 20388304e81fc8f158839633f720e2152f17fd6b Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Thu, 11 Sep 2025 13:25:36 -0700 Subject: [PATCH] PDF input: spreadshift behavior is inverted so Humble PDF's don't need to check it (#1082) * pdf input: spreadshift behavior is inverted so Humble PDF's don't need to check it * remove pdf spreadshift from readme --- README.md | 2 +- kindlecomicconverter/comic2ebook.py | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6a40934..97cb0d4 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ When using a reMarkable profile (Rmk1, Rmk2, RmkPP), the format automatically de for optimal compatibility with your device's native PDF reader. The absolute highest quality source files are print quality DRM-free PDFs from Kodansha/[Humble Bundle](https://humblebundleinc.sjv.io/xL6Zv1)/Fanatical, -which can be directly converted by KCC. Be sure to check the spread shift option! +which can be directly converted by KCC. Its main feature is various optional image processing steps to look good on eink screens, which have different requirements than normal LCD screens. diff --git a/kindlecomicconverter/comic2ebook.py b/kindlecomicconverter/comic2ebook.py index 61ac574..cc6d98a 100755 --- a/kindlecomicconverter/comic2ebook.py +++ b/kindlecomicconverter/comic2ebook.py @@ -278,7 +278,7 @@ def buildNAV(dstdir, title, chapters, chapternames): f.close() -def buildOPF(dstdir, title, filelist, cover=None): +def buildOPF(dstdir, title, filelist, originalpath, cover=None): opffile = os.path.join(dstdir, 'OEBPS', 'content.opf') deviceres = options.profileData[1] if options.righttoleft: @@ -366,6 +366,11 @@ def buildOPF(dstdir, title, filelist, cover=None): else: f.write("\n\n") pageside = "left" + if originalpath.lower().endswith('.pdf'): + if pageside == "right": + pageside = "left" + else: + pageside = "right" if options.spreadshift: if pageside == "right": pageside = "left" @@ -440,7 +445,7 @@ def buildOPF(dstdir, title, filelist, cover=None): ""]) f.close() -def buildEPUB(path, chapternames, tomenumber, ischunked, cover: image.Cover, len_tomes=0): +def buildEPUB(path, chapternames, tomenumber, ischunked, cover: image.Cover, originalpath, len_tomes=0): filelist = [] chapterlist = [] os.mkdir(os.path.join(path, 'OEBPS', 'Text')) @@ -580,7 +585,7 @@ def buildEPUB(path, chapternames, tomenumber, ischunked, cover: image.Cover, len chapternames[filename] = aChapter[1] buildNCX(path, options.title, chapterlist, chapternames) buildNAV(path, options.title, chapterlist, chapternames) - buildOPF(path, options.title, filelist, cover) + buildOPF(path, options.title, filelist, originalpath, cover) def buildPDF(path, title, cover=None, output_file=None): @@ -1579,10 +1584,10 @@ def makeBook(source, qtgui=None): else: print("Creating EPUB file...") if len(tomes) > 1: - buildEPUB(tome, chapterNames, tomeNumber, True, cover, len(tomes)) + buildEPUB(tome, chapterNames, tomeNumber, True, cover, source, len(tomes)) filepath.append(getOutputFilename(source, options.output, '.epub', ' ' + str(tomeNumber))) else: - buildEPUB(tome, chapterNames, tomeNumber, False, cover) + buildEPUB(tome, chapterNames, tomeNumber, False, cover, source) filepath.append(getOutputFilename(source, options.output, '.epub', '')) makeZIP(tome + '_comic', tome, True) # Copy files to final destination (PDF files are already saved directly)