Skip to content

Commit

Permalink
Adding the specified height & width to export PDF request (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
renoyjohnm authored Jan 31, 2025
1 parent 8848740 commit 17edb1e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 6 additions & 0 deletions tests/commands/test_datasources_and_workbooks_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 17edb1e

Please sign in to comment.