Skip to content

Commit 2635575

Browse files
committed
Routine updates.
1 parent 16e1230 commit 2635575

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ebook_extractor/export/pdf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
from textwrap import wrap as _wrap
2+
from time import sleep as _sleep
23

34
from fpdf import FPDF as _FPDF
45

56
from ebook_extractor.prototype import Book as _Book
67

78

8-
def save_as_pdf(book: _Book, path: str, as_text: bool = False) -> None:
9+
def save_as_pdf(book: _Book, path: str, as_text: bool = False, time_interval: float = .5) -> None:
910
if as_text:
1011
text = "\n".join(page.to_text() for page in book)
1112
a4_width_mm = 210
@@ -30,5 +31,6 @@ def save_as_pdf(book: _Book, path: str, as_text: bool = False) -> None:
3031
else:
3132
images = []
3233
for page in book:
34+
_sleep(time_interval)
3335
images.append(page.to_pillow())
3436
images[0].save(path, "PDF", resolution=100, save_all=True, append_images=images[1:])

0 commit comments

Comments
 (0)