server-client-python icon indicating copy to clipboard operation
server-client-python copied to clipboard

Resolution parameters for PDF generation

Open adbumi opened this issue 2 years ago • 0 comments

Summary

The Tableau REST API supports the resolution parameters vizHeight and vizWidth for PDF generation of views and workbooks, but the tableauserclient does not provide this capability.

Suggested implementation

The implementation in tableauserclient seems to be quite simple. It is just a matter of adding these additional parameters to the PDFRequestOptions class and extending the get_query_params() method for the parameters.

I have inherited a child class from PDFRequestOptions and added the functionality. However, I would appreciate it if this functionality could be added to the tsc module as updates to the base class could otherwise break it.

This is my workaround implementation:

`class PdfOptions(PDFRequestOptions):

    def __init__(self, page_type, orientation, viz_height, viz_width):
        super(PdfOptions, self).__init__(page_type, orientation)
        self.viz_height = viz_height
        self.viz_width = viz_width

   def get_query_params(self):
        params = super().get_query_params()

        if self.viz_height:
            params["vizHeight"] = self.viz_height
        if self.viz_width:
            params["vizWidth"] = self.viz_width

        self._append_view_filters(params)
        return params

`

adbumi avatar Nov 23 '23 14:11 adbumi