Cách làm Ebook
- Chia nhỏ file pdf - https://www.ilovepdf.com/
- Upload Google Drive, mở pdf trong Word ⇒ OCR để convert ảnh/pdf sang text
- Biên tập file Word
- Convert file docx sang epub bằng Calibre
- Biên tập html/css file
- Đóng gói (Convert to epub bằng Calibre)
Biên tập file word
Notes
Mục đích bước này là OCR to get text - không cần phải quá quan trọng style
-
Font size cho toàn bộ văn bản
- Chú ý tới font mặc định
- Time New Roman, font 12
- Format > Paragraph styles > Normal Text > Update ‘Normal text’ to match rồi vào Options > Save as my default styles.
-
Giãn dòng - Line spacing
- Format > Line & paragraph spacing - Chọn 1.5
- Paragraph spacing before/after: 0 pt (hoặc 6 pt nếu bạn thích có khoảng cách giữa đoạn)
-
Căn đều nội dung văn bản
- Chọn văn bản
- Format > Align & Indent > Justified.
-
Đánh số trang
- Insert > Page numbers.
-
Tạo tiêu đề và Mục lục
-
Set ruler đồng bộ cho toàn bộ file
Cmd + Enter để break content sang trang mới
Biên tập file epub
- File doc sau khi convert/ soát lỗi chính tả xong thì vẫn sẽ còn nhiều lỗi linh tinh ⇒ Chỉnh sửa dần
- Mở lên bằng Calibre, convert từ docx sang epub
- Save to disk file epub này, đổi tên file thành .zip sau đó giải nén sẽ ra được 1 folder code html, css, …
- Mở băng Cursor, sau đó edit html file
- Nên học theo cách style của các cuốn ebook mình đã từng làm trước đây, đại khái là sẽ có style cho:
- h1 heading
- h2 heading
- images
- quotes
- Một số trang đặc biệt
- Sau khi sửa xong, cần phải chỉnh lại trong file
content.opf
cho map với file của mình - Các bước trên đã done thì zip lại folder, đổi tên thành
.epub
, hoặc sử dụng script bên dưới - Nếu file epub bị lỗi, thì mở nó bằng Calibre, sau đó dùng tính năng convert để convert nó sang epub file
import zipfile
import os
def create_epub(epub_name, source_dir):
with zipfile.ZipFile(epub_name, 'w') as epub:
# Add mimetype file first and uncompressed
epub.write(os.path.join(source_dir, 'mimetype'), 'mimetype', compress_type=zipfile.ZIP_STORED)
# Walk the folder and add the rest
for foldername, subfolders, filenames in os.walk(source_dir):
for filename in filenames:
if filename == 'mimetype':
continue
full_path = os.path.join(foldername, filename)
rel_path = os.path.relpath(full_path, source_dir)
epub.write(full_path, rel_path)
create_epub("output.epub", "BCTC")
References
- https://drive.google.com/drive/u/0/folders/1tz9zxxkOsMND1TgdhPkctwnF_3kfxZAa - Cách biên tập ebook - Lâm Taxy