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
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")
The text was updated successfully, but these errors were encountered:
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
Some background:
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:
The text was updated successfully, but these errors were encountered: