1+ import sys
2+
13from tableauserverclient .models .property_decorators import property_is_int
24import logging
35
@@ -261,11 +263,13 @@ class Orientation:
261263 Portrait = "portrait"
262264 Landscape = "landscape"
263265
264- def __init__ (self , page_type = None , orientation = None , maxage = - 1 ):
266+ def __init__ (self , page_type = None , orientation = None , maxage = - 1 , viz_height = None , viz_width = None ):
265267 super (PDFRequestOptions , self ).__init__ ()
266268 self .page_type = page_type
267269 self .orientation = orientation
268270 self .max_age = maxage
271+ self .viz_height = viz_height
272+ self .viz_width = viz_width
269273
270274 @property
271275 def max_age (self ):
@@ -276,6 +280,24 @@ def max_age(self):
276280 def max_age (self , value ):
277281 self ._max_age = value
278282
283+ @property
284+ def viz_height (self ):
285+ return self ._viz_height
286+
287+ @viz_height .setter
288+ @property_is_int (range = (0 , sys .maxsize ), allowed = (None ,))
289+ def viz_height (self , value ):
290+ self ._viz_height = value
291+
292+ @property
293+ def viz_width (self ):
294+ return self ._viz_width
295+
296+ @viz_width .setter
297+ @property_is_int (range = (0 , sys .maxsize ), allowed = (None ,))
298+ def viz_width (self , value ):
299+ self ._viz_width = value
300+
279301 def get_query_params (self ):
280302 params = {}
281303 if self .page_type :
@@ -287,6 +309,15 @@ def get_query_params(self):
287309 if self .max_age != - 1 :
288310 params ["maxAge" ] = self .max_age
289311
312+ if (self .viz_height is None ) ^ (self .viz_width is None ):
313+ raise ValueError ("viz_height and viz_width must be specified together" )
314+
315+ if self .viz_height is not None :
316+ params ["vizHeight" ] = self .viz_height
317+
318+ if self .viz_width is not None :
319+ params ["vizWidth" ] = self .viz_width
320+
290321 self ._append_view_filters (params )
291322
292323 return params
0 commit comments