Quantcast
Channel: MobileRead Forums
Viewing all articles
Browse latest Browse all 50094

pdf to epub

$
0
0
i am trying to convert pdf to epub file using calibre
first i tried calibre gui which is taking hours but cannot convert that pdf to epub then i use python script with calibre ebook-convert.exe and that is converting pdf to epub but missing a lot of setting i am sharing you screenshot of pdf text and converted epub same area.
check attached files (First image is original PDF and second image is converted epub and see text and diagram is broken in epub)

here is my script code

import subprocess
import os

# Path to your input PDF
pdf_path = r"C:\Users\samsam\Downloads\Analysis of Fork.pdf" # <-- Change 'mybook.pdf' to your actual file name

# Output EPUB path (same folder)
epub_path = os.path.splitext(pdf_path)[0] + ".epub"

# Full path to ebook-convert.exe
calibre_convert_exe = r"C:\Program Files\Calibre2\ebook-convert.exe"

# Command to run conversion
command = [
calibre_convert_exe,
pdf_path,
epub_path,
"--disable-font-rescaling",
"--no-default-epub-cover",
"--preserve-cover-aspect-ratio"

]

try:
subprocess.run(command, check=True)
print(f"✅ EPUB created: {epub_path}")
except subprocess.CalledProcessError as e:
print("❌ Conversion failed:", e)

Attached Thumbnails
Click image for larger version

Name:	pdf ss.jpg
Views:	N/A
Size:	101.6 KB
ID:	216513   Click image for larger version

Name:	epub ss.jpg
Views:	N/A
Size:	150.9 KB
ID:	216514  

Viewing all articles
Browse latest Browse all 50094

Latest Images

Trending Articles



Latest Images