Skip to content

Commit bda9be1

Browse files
committed
Updates
1 parent 3ba2ce6 commit bda9be1

File tree

14 files changed

+16
-12
lines changed

14 files changed

+16
-12
lines changed

reporting/examples/filmfestival-2tables/filmfestival.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,6 @@ def get_actor_items():
143143
report.header = [header]
144144
report.sections = [
145145
[film_items, Options(cols=1, format="A3", newpage=True)],
146-
[actor_items, Options(format=Size(300, 600))],
146+
[actor_items, Options(format=Size(600, 400))],
147147
]
148148
report.run("output.pdf")
Binary file not shown.

reporting/examples/invoice/invoicer.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from Reports import *
77

88
# The following defines the overall report object
9-
mediabox = fitz.paper_rect("letter-l")
9+
mediabox = fitz.paper_rect("a4-l")
1010
report = Report(mediabox)
1111

1212
# Predefined HTML to define the header for all pages
@@ -141,8 +141,10 @@ def fetch_rows():
141141
# -----------------------------------------------------------------------------
142142

143143
report.header = [logo, header]
144-
report.sections = [[prolog, Options(cols=1, format="letter-l")],
145-
[items, Options(newpage=False)]]
144+
report.sections = [
145+
[prolog, Options(cols=1, format=report.mediabox)],
146+
[items, Options(format=report.mediabox, newpage=False)],
147+
]
146148

147149
# This generates the report and saves it to the given path name.
148150
report.run("output.pdf")

reporting/examples/invoice/output.pdf

-21.4 KB
Binary file not shown.

reporting/examples/multi-format/national-capitals.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ def get_data():
6767

6868
# compose the report from above sections
6969
report.header = [header] # appears on every page
70-
report.sections = [
71-
[items, Options(cols=2, format="a3")]
72-
] # 2 columns per page
70+
report.sections = [[items, Options(cols=2, format=report.mediabox)]]
7371

7472
# output the report
7573
report.run("output.pdf")
247 Bytes
Binary file not shown.
-3.22 KB
Binary file not shown.

reporting/examples/row-with-images/rows-with-images.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020

2121
HTML = """
2222
<style>
23-
body {font-family: sans-serif;font-size: 14px;}
23+
body {font-family: sans-serif;font-size: 11px;}
2424
td, th {
2525
padding-left: 10px;
2626
padding-right: 10px;
2727
}
28+
table {margin-left: 20%;}
2829
</style>
2930
3031
<body>
@@ -61,11 +62,11 @@ def fetch_rows():
6162
top_row="header",
6263
fetch_rows=fetch_rows,
6364
archive=national_flags,
64-
alternating_bg=("#ccc", "#aaa", "#fff"),
65+
alternating_bg=("#ccc", "#ddd", "#eee"),
6566
)
6667

6768
report.sections = [
68-
[items, Options(cols= 1, format="letter", newpage=True)],
69+
[items, Options(cols=1, format="letter", newpage=True)],
6970
] # set sections list
7071
report.header = [header]
7172
report.footer = [footer]
-1.99 KB
Binary file not shown.

reporting/examples/simple-article/simple-article.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
HTML = pathlib.Path("springer.html").read_bytes().decode()
88
textblock = Block(html=HTML, report=report)
99

10-
report.sections = [[textblock, Options(cols=2, format=fitz.Rect(0, 0, 400, 600), newpage=True)]]
10+
report.sections = [[textblock, Options(cols=2, format=report.mediabox, newpage=True)]]
1111
report.run("output.pdf")

reporting/examples/user-fonts/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,7 @@ Nothing else in the report program has to be changed: The Story's layout engine
3232
## Case: Kenpixel
3333
For further illustration purposes, script [kenpixel.py](https://github.com/pymupdf/PyMuPDF-Utilities/blob/master/reporting/examples/user-fonts/kenpixel.py) does the same thing with the small and quite exotic font "kenpixel.ttf".
3434

35-
When looking at the resulting report files, both have similar sizes - although the DejaVu font files are very much larger than Kenpixel. This effect is achieved by PyMuPDF's in-built font subsetting engine which compresses fonts by eliminating all unused characters.
35+
## Conclusion
36+
When looking at the resulting report files, both have similar sizes (37 KB vs. 41 KB) - although the two DejaVu font files are **_very much larger_** (>= 600 KB each) than Kenpixel (18 KB). This effect is achieved by PyMuPDF's in-built font subsetting engine which compresses fonts by eliminating all unused characters.
37+
38+
The Reporting code automatically invokes font sub-setting. Therefore, even if the text is polyglot and many font files must be referenced, the resulting PDF file size remains within reasonable limits.

reporting/image.png

-38.9 KB
Binary file not shown.

reporting/pymupdf-reporting.pdf

-129 Bytes
Binary file not shown.

reporting/pymupdf-reporting.pptx

221 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)