Skip to content

Commit a887a60

Browse files
authored
A5 page dimensions fix #1699 (#1703)
1 parent 85487fc commit a887a60

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ This can also be enabled programmatically with `warnings.simplefilter('default',
2020
### Added
2121
* support for SVG `<linearGradient>` and `<radialGradient>` elements - _cf._ [issue #1580](https://github.com/py-pdf/fpdf2/issues/1580) - thanks to @Ani07-05
2222
### Fixed
23+
* the `A5` value that could be specified as page `format` to the `FPDF` constructor was slightly incorrect, and the corresponding page dimensions have been fixed. This could lead to a minor change in your documents dimensions if you used this `A5` page format. - _cf._ [issue #1699](https://github.com/py-pdf/fpdf2/issues/1699)
2324
* a bug when rendering empty tables with `INTERNAL` layout, that caused an extra border to be rendered due to an erroneous use of `list.index()` - _cf._ [issue #1669](https://github.com/py-pdf/fpdf2/issues/1669)
2425
### Changed
2526
* improved performance when rendering paths, SVGs, and opaque raster images with an alpha channel - _cf._ [PR #1675](https://github.com/py-pdf/fpdf2/pull/1675)

fpdf/fpdf.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ class Image:
165165
FPDF_VERSION = "2.8.5"
166166
__version__ = FPDF_VERSION
167167
PAGE_FORMATS = {
168-
"a3": (841.89, 1190.55),
169-
"a4": (595.28, 841.89),
170-
"a5": (420.94, 595.28),
168+
"a3": (841.89, 1190.55), # 297mm × 420mm
169+
"a4": (595.28, 841.89), # 210mm × 297mm
170+
"a5": (419.53, 595.28), # 148mm x 210mm
171171
"letter": (612, 792),
172172
"legal": (612, 1008),
173173
}
@@ -219,6 +219,11 @@ def get_page_format(format, k=None):
219219
if isinstance(format, str):
220220
format = format.lower()
221221
if format in PAGE_FORMATS:
222+
if format == "a5":
223+
warnings.warn(
224+
# This warning should be removed in the next release:
225+
"Dimensions for page format A5 were fixed in release 2.8.5"
226+
)
222227
return PAGE_FORMATS[format]
223228
raise FPDFPageFormatException(format, unknown=True)
224229

-7 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)