9 Replies Latest reply on Dec 21, 2018 1:36 PM by Jonathan Drummey

    VIZ_PDF how to set pagesize A4?

    Enrico Franchini


      we have a problem with VizAlert.

      When we generate pdf with VIZ_PDF the default page size is "letter" and is not what we want.


      Is there a way to set pdf page size on A4?

      Tableau Server Version: 10.4.1



        • 1. Re: VIZ_PDF how to set pagesize A4?
          Jonathan Drummey

          What is the page size set to in the viz when you use File->Page Setup in Tableau Desktop?



          • 2. Re: VIZ_PDF how to set pagesize A4?
            Enrico Franchini

            Hi Jonathan

            sorry for the late reply.

            In Page Setup (Tableau Desktop) there is no setting related to the page size,

            I can only set: margins, center (checked in Horizontally and Vertically), Print Scaling (checked Fit to no more than 1 by 1), Page Orientation (Portrait).

            My size dashboard is set to  A4 Portrait in Tableau desktop.

            In Tableau Server when I export to pdf (Download – PDF) if I set the page size “A4”, my viz is centered on the page, instead if I use page size "Letter" my viz is not centered.

            Same thing if I use tabcmd commands:

            tabcmd export "...." --fullpdf --pagesize a4 , my viz is centered on page

            tabcmd export "...." –fullpdf (default pagesize is “Letter”, my viz is not centered.

            I would like to understand if I can add pagesize parameter in Viz Allert





            • 3. Re: VIZ_PDF how to set pagesize A4?
              Matt Coles

              Unfortunately, you cannot pass in a pagesize parameter in to a content reference within VizAlerts. I don't expect we'll get to adding that as a feature in the near term, either, so if you need something immediately, you will need to add the code needed to do so.

              • 4. Re: VIZ_PDF how to set pagesize A4?
                Enrico Franchini

                Hi Matt,

                thanks for the answer.

                We would like to develop the functionality in vizalerts.

                We have seen in the python module vizalert/tabhttp.py at line 191 how the url is built to download the pdf from tableau server.

                Can you tell us which querystring parameter we need to pass in order to specify the page size (A4, Letter, etc.)?


                • 5. Re: VIZ_PDF how to set pagesize A4?
                  Matt Coles

                  That's the trouble; there isn't one. Otherwise you'd already have this feature!


                  Here's the list of embed URL Parameters: Parameters for Embed Code. Pagesize just isn't there.


                  The only real way to do this programmatically would be to integrate Tabcmd into it. This is a command-line executable that will require some more extensive code changes, config changes, and documentation changes to integrate. It also would not work for Linux machines, something that VizAlerts will currently run on. All these reasons are why we haven't integrated it ourselves yet.


                  For your own purposes, you could hack it in, but I'd estimate the work to require maybe four to eight days of dedicated developer and testing time. You'd probably need the following:


                  1. New config values in config/vizalerts.yaml for the username / password for a Server Admin account used for tabcmd calls.

                  2. Code changes to the find_viz_refs function to add a new parameter to content references. I'd suggest it be of the format "|pagesize=###"

                         2a. Code changes to the same function, around here, to detect any content reference that uses your new parameter for PDF exports, and route that call to a different function that calls Tabcmd, or maybe add that logic to tabhttp.export_view.

                  3. Wherever you put that logic, the command you'll want to do is:

                        "tabcmd export 'yourworkbook/yourview' --pdf --pagesize=yourpagesize --filename=yourfilename --timeout=yourtimeout -s yourserver -u youradminuser -p youradminpassword --no-cookie"


                  Couple of other thoughts:


                  • Might want to include a conditional --no-certcheck parameter since we support that with the server.certcheck value in config\vizalerts.yaml
                  • Should make the tabcmd call work with a password file, rather than a plaintext password, which is a slightly more secure option (whatever the case, don't output your password to any logs!)
                  • I'd love to make a new Action of type "Tabcmd" (or maybe "Tableau Server") that we could put a bunch of the different Tabcmd stuff into...publish, export, refreshextracts, etc. That's probably the real way to get what we want out of this, long-term.
                  • 6. Re: VIZ_PDF how to set pagesize A4?

                    Has this been added in 2018.2 ?

                    • 7. Re: VIZ_PDF how to set pagesize A4?
                      Matt Coles

                      No, not that I have heard, nor is there anything new on this page, nor on the REST API.

                      • 8. Re: VIZ_PDF how to set pagesize A4?
                        Byron Kats

                        I am wondering why tableau doesn't let us pass the parameter of pagesize if we can be able to pass other parameters. Tableau basically specializes in making very simple things painful for people that use the tool

                        • 9. Re: VIZ_PDF how to set pagesize A4?
                          Jonathan Drummey

                          Hi Byron,


                          Tableau is always a work in progress... I regularly see feature B being added as an extra option (and potential replacement) for feature A only sub-features A.N and A.M aren't implemented in B. For example when first implemented the REST API did not have a capability to download images, now it does, and in case the pagesize options that are available through manual export and tabcmd still haven't been made available through the REST API.