Skip to content

Commit 38f6880

Browse files
committed
Print multiple documents with one command
1 parent 3d6fb4e commit 38f6880

7 files changed

Lines changed: 50 additions & 5 deletions

File tree

.github/workflows/ci-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424

2525
- name: Install Google Chrome
2626
run: |
27-
choco install googlechrome --no-progress -y
27+
choco install googlechrome --no-progress -y --ignore-checksums
2828
shell: powershell
2929

3030
- name: Check Chrome Version

html2print/html2print.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from webdriver_manager.core.http import HttpClient
2424
from webdriver_manager.core.os_manager import OperationSystemManager
2525

26-
__version__ = "0.0.4"
26+
__version__ = "0.0.5"
2727

2828
DEFAULT_CACHE_DIR = os.path.join(Path.home(), ".html2print", "chromedriver")
2929

@@ -316,7 +316,7 @@ def exit_handler():
316316
assert len(paths) % 2 == 0, (
317317
f"Expecting an even number of input/output path arguments: {paths}."
318318
)
319-
for current_pair_idx in range(0, 2, len(paths)):
319+
for current_pair_idx in range(0, len(paths), 2):
320320
path_to_input_html = paths[current_pair_idx]
321321
path_to_output_pdf = paths[current_pair_idx + 1]
322322

tests/integration/03_cache_dir_argument/test.itest

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ RUN: %html2pdf print --cache-dir %S/Output/cache %S/index.html %S/Output/index.p
22
RUN: %check_exists --file "%S/Output/index.pdf"
33
RUN: python %S/test.py
44

5-
CHECK-RUN1: html2pdf: ChromeDriver does not exist in the local cache:
5+
CHECK-RUN1: html2print: ChromeDriver does not exist in the local cache:
66

77
RUN: %html2pdf print --cache-dir %S/Output/cache %S/index.html %S/Output/index.pdf | filecheck %s --dump-input=fail --check-prefix CHECK-RUN2
88
RUN: %check_exists --file "%S/Output/index.pdf"
99
RUN: python %S/test.py
1010

11-
CHECK-RUN2: html2pdf: ChromeDriver exists in the local cache:
11+
CHECK-RUN2: html2print: ChromeDriver exists in the local cache:
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!doctype html>
2+
<html lang="">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<title>Test page</title>
7+
<script src="../../../submodules/html2pdf/dist/bundle.js"></script>
8+
<link rel="stylesheet" href="../../../submodules/html2pdf/test/shared/css/main.css">
9+
</head>
10+
11+
<body>
12+
<p>Hello world!</p>
13+
</body>
14+
15+
</html>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!doctype html>
2+
<html lang="">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<title>Test page</title>
7+
<script src="../../../submodules/html2pdf/dist/bundle.js"></script>
8+
<link rel="stylesheet" href="../../../submodules/html2pdf/test/shared/css/main.css">
9+
</head>
10+
11+
<body>
12+
<p>Hello world!</p>
13+
</body>
14+
15+
</html>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
RUN: %html2pdf print %S/index1.html %S/Output/index1.pdf %S/index2.html %S/Output/index2.pdf
2+
3+
RUN: %check_exists --file "%S/Output/index1.pdf"
4+
RUN: %check_exists --file "%S/Output/index2.pdf"
5+
6+
RUN: python %S/test.py
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from pypdf import PdfReader
2+
3+
reader = PdfReader("Output/index1.pdf")
4+
assert len(reader.pages) == 1
5+
assert reader.pages[0].extract_text() == "Hello world!"
6+
7+
reader = PdfReader("Output/index2.pdf")
8+
assert len(reader.pages) == 1
9+
assert reader.pages[0].extract_text() == "Hello world!"

0 commit comments

Comments
 (0)