Skip to content

Instantly share code, notes, and snippets.

@bergpb
Last active March 2, 2024 04:13
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save bergpb/fb15fbebf41190d2298339d484e589a0 to your computer and use it in GitHub Desktop.
Save bergpb/fb15fbebf41190d2298339d484e589a0 to your computer and use it in GitHub Desktop.
Script to convert pdf to epub.
import os
from time import sleep
path = os.getcwd()
files = os.listdir(path)
#install package
os.system('sudo apt install calibre -y && sudo apt update')
#remove espacos e insere _
for file in files:
os.rename(os.path.join(path, file), os.path.join(path, file.replace(' ', '_')))
for file in files:
if file.endswith('.pdf'):
f = file.split('.')
f = f[0]
os.system('ebook-convert {} {}.epub'.format(file, f))
sleep(10)
print ('Finalizado.....')
@MedoHamdani
Copy link

Does it work on Arabic PDF images?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment