From 17edb1ece90fc35b78d95f88a82532ae4ad8055d Mon Sep 17 00:00:00 2001 From: renoyjohnm <168143499+renoyjohnm@users.noreply.github.com> Date: Thu, 30 Jan 2025 17:28:05 -0800 Subject: [PATCH] Adding the specified height & width to export PDF request (#345) --- .../datasources_and_workbooks_command.py | 4 ++++ tests/commands/test_datasources_and_workbooks_command.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/tabcmd/commands/datasources_and_workbooks/datasources_and_workbooks_command.py b/tabcmd/commands/datasources_and_workbooks/datasources_and_workbooks_command.py index 5cc73363..86b0144c 100644 --- a/tabcmd/commands/datasources_and_workbooks/datasources_and_workbooks_command.py +++ b/tabcmd/commands/datasources_and_workbooks/datasources_and_workbooks_command.py @@ -156,6 +156,10 @@ def apply_pdf_options(logger, request_options: TSC.PDFRequestOptions, args): request_options.orientation = args.pagelayout if args.pagesize: request_options.page_type = args.pagesize + if args.height: + request_options.viz_height = int(args.height) + if args.width: + request_options.viz_width = int(args.width) @staticmethod def save_to_data_file(logger, output, filename): diff --git a/tests/commands/test_datasources_and_workbooks_command.py b/tests/commands/test_datasources_and_workbooks_command.py index 6556d0f6..015be6f2 100644 --- a/tests/commands/test_datasources_and_workbooks_command.py +++ b/tests/commands/test_datasources_and_workbooks_command.py @@ -65,12 +65,18 @@ def test_apply_png_options_bad_values(self): def test_apply_pdf_options(self): expected_page = tsc.PDFRequestOptions.PageType.Folio.__str__() expected_layout = tsc.PDFRequestOptions.Orientation.Portrait.__str__() + expected_height = 800 + expected_width = 600 mock_args.pagelayout = expected_layout mock_args.pagesize = expected_page + mock_args.height = expected_height + mock_args.width = expected_width request_options = tsc.PDFRequestOptions() DatasourcesAndWorkbooks.apply_pdf_options(mock_logger, request_options, mock_args) assert request_options.page_type == expected_page assert request_options.orientation == expected_layout + assert request_options.viz_width == expected_width + assert request_options.viz_height == expected_height @mock.patch("tableauserverclient.Server")