You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PDF size from populated views too large - help wanted/bug #1382
Goal here is to download multiple filtered views as a pdf, ideally this should be done directly at a workbook level, but the filters don't work across the workbook.
Have browsed various suggested methods here and on the internet and the suggested approach was to filter each view seperately, download filtered view pdfs separately and merge them.
So approach is populate each view with applied filters, append them into a bytesIO stream and write to pdf.
Issue is this approach generates large pdfs from the views ~200KB resulting in an approx 1.8 MB pdf file (5 pages), alternatively doing so directly on the Tableau dashboard I can download multiple views (technically entire dashboard) in a smaller pdf ~ 917KB !
Code:
import pypdf as pdf
from io import BytesIO
pdflist=[]
for i in range(len(views)):
server.views.populate_pdf(views[i],pdf_req_option)
writer = pdf.PdfWriter()
for j in range(len(pdflist)):
stream = BytesIO(pdflist[j].pdf)
writer.append(stream)
#---Compress and merge pdf
writer.write("filename.pdf")
Thanks, well print to pdf paper type used is letter in both cases, even tried with type unspecified, so not sure how width/height is going to help here
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. If this is still relevant, please comment to keep it open.
Closing -- this is supported. server.workbooks.populate_pdf(workbook_item, req_options) takes a PDFRequestOptions, which exposes vf(name, value) for view filters and parameter(name, value) for parameters. See tableauserverclient/server/endpoint/workbooks_endpoint.py:583 and tableauserverclient/server/request_options.py:531.
That gets a single server-rendered PDF with the filter applied across the whole workbook, which avoids the per-view download + client-side merge loop in the original report (the size difference was PDF concatenation overhead, not TSC).
Activity
jorwoods commentedon May 31, 2024
In the upcoming 0.31 release you will be able to specify viz width and height when retrieving PDFs. #1348
This should allow you to more precisely control your output size and give an apples to apples comparison.
d-bhatia commentedon May 31, 2024
Thanks, well print to pdf paper type used is letter in both cases, even tried with type unspecified, so not sure how width/height is going to help here
jacalata commentedon Jun 21, 2024
We will fix the server issue of not filtering a workbook and have it available this year.
For a more immediate way to improve your exported pdfs, there are a lot of suggestions in this thread about compressing or optimizing pdfs including several python libraries.
https://stackoverflow.com/questions/59614014/pypdf4-exported-pdf-file-size-too-big
jacalata commentedon Sep 20, 2024
This has been implemented
github-actions commentedon Jul 25, 2026
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. If this is still relevant, please comment to keep it open.
jacalata commentedon Aug 16, 2026
Closing -- this is supported.
server.workbooks.populate_pdf(workbook_item, req_options)takes aPDFRequestOptions, which exposesvf(name, value)for view filters andparameter(name, value)for parameters. Seetableauserverclient/server/endpoint/workbooks_endpoint.py:583andtableauserverclient/server/request_options.py:531.Usage:
That gets a single server-rendered PDF with the filter applied across the whole workbook, which avoids the per-view download + client-side merge loop in the original report (the size difference was PDF concatenation overhead, not TSC).