Skip to content

Commit

Permalink
Fix wrong PageSize for A4 (#24)
Browse files Browse the repository at this point in the history
* Fix wrong PageSize for A4

Change the Letter size to be 8.5x11 and the A4 size to be actual A4 size.

* Add Final to Letter PageSize

* Update CHANGELOG.md

---------

Co-authored-by: Trenton Holmes <[email protected]>
  • Loading branch information
mannerydhe and stumpylog authored Jul 8, 2024
1 parent b1d279b commit 3ee137c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed

- Wrong paper size preset for A4 ([#24](https://github.com/stumpylog/gotenberg-client/pull/24))

## [0.6.0] - 2024-06-13

### Breaking Change
Expand Down
4 changes: 2 additions & 2 deletions src/gotenberg_client/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ def to_form(self) -> Dict[str, str]:
A1: Final = PageSize(width=23.4, height=33.1)
A2: Final = PageSize(width=16.54, height=23.4)
A3: Final = PageSize(width=11.7, height=16.54)
A4: Final = PageSize(width=8.5, height=11)
A4: Final = PageSize(width=8.27, height=11.7)
A5: Final = PageSize(width=5.83, height=8.27)
A6: Final = PageSize(width=4.13, height=5.83)
Letter = A4
Letter: Final = PageSize(width=8.5, height=11)
Legal: Final = PageSize(width=8.5, height=14)
Tabloid: Final = PageSize(width=11, height=17)
Ledge: Final = PageSize(width=17, height=11)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_convert_chromium_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ def test_convert_page_size(self, client: GotenbergClient, httpx_mock: HTTPXMock)
_ = route.index(test_file).size(A4).run()

request = httpx_mock.get_request()
verify_stream_contains("paperWidth", "8.5", request.stream)
verify_stream_contains("paperHeight", "11", request.stream)
verify_stream_contains("paperWidth", "8.27", request.stream)
verify_stream_contains("paperHeight", "11.7", request.stream)

def test_convert_margin(self, client: GotenbergClient, httpx_mock: HTTPXMock):
httpx_mock.add_response(method="POST")
Expand Down

0 comments on commit 3ee137c

Please sign in to comment.