Skip to content

Commit 17edb1e

Browse files
authored
Adding the specified height & width to export PDF request (#345)
1 parent 8848740 commit 17edb1e

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

tabcmd/commands/datasources_and_workbooks/datasources_and_workbooks_command.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ def apply_pdf_options(logger, request_options: TSC.PDFRequestOptions, args):
156156
request_options.orientation = args.pagelayout
157157
if args.pagesize:
158158
request_options.page_type = args.pagesize
159+
if args.height:
160+
request_options.viz_height = int(args.height)
161+
if args.width:
162+
request_options.viz_width = int(args.width)
159163

160164
@staticmethod
161165
def save_to_data_file(logger, output, filename):

tests/commands/test_datasources_and_workbooks_command.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,18 @@ def test_apply_png_options_bad_values(self):
6565
def test_apply_pdf_options(self):
6666
expected_page = tsc.PDFRequestOptions.PageType.Folio.__str__()
6767
expected_layout = tsc.PDFRequestOptions.Orientation.Portrait.__str__()
68+
expected_height = 800
69+
expected_width = 600
6870
mock_args.pagelayout = expected_layout
6971
mock_args.pagesize = expected_page
72+
mock_args.height = expected_height
73+
mock_args.width = expected_width
7074
request_options = tsc.PDFRequestOptions()
7175
DatasourcesAndWorkbooks.apply_pdf_options(mock_logger, request_options, mock_args)
7276
assert request_options.page_type == expected_page
7377
assert request_options.orientation == expected_layout
78+
assert request_options.viz_width == expected_width
79+
assert request_options.viz_height == expected_height
7480

7581

7682
@mock.patch("tableauserverclient.Server")

0 commit comments

Comments
 (0)