Last active
September 2, 2024 02:07
-
-
Save bergpb/fb15fbebf41190d2298339d484e589a0 to your computer and use it in GitHub Desktop.
Script to convert pdf to epub.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.....') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does it work on Arabic PDF images?