Downloading current panel view as pdf

I am using panel on bokeh, and I want to download the current view in the panel as pdf, is it possible?

It is currently not possible, bokeh supports exporting individual plots as svgs but that wouldn’t cover the whole view and each plot is exported individually. There might be some solution by using a headless chromedriver to PDF print the page.

I’ve previously experimented with the options listed in the bokeh docs (e.g. crowbar) but never made that work. Please keep us updated @dewshrs!

Is there any update about this ?

Nope I don’t think so. @Marc has been working on a PR to make screenshots but I don’t know how advanced or even how likely this is to be merged. Feel free to open a feature request on Panel’s issue tracker if this is a feature that you would really like Panel to have!

1 Like

From what I’ve been able to google search, exporting to PDF is a general problem to solve across web applications and its not easy. I believe its very difficult to get right.

1 Like

Have you any updates about this? I want to make from some panel charts to one pdf.

I’ve been wanting to look into this as well, but haven’t gotten around to it yet.
I’m thinking there might be a possibility using the to HTML, then converting the HTML to PDF?
I don’t know whether this will work with every object though, and I don’t know if there are good python libraries to generate a pdf from an html file.

Below short program is not complete program. But we can make pdf make use of reportlab to make pdf file.

Now I am searching to change from panel to image.
If we can change from panel to image, we can make pdf file what we want.

Below link is the solution to change from panel to image . But I can’t use below solution. Because of my edge browser.

I want someone help.
[How to save panel object to png without file extension]

from reportlab.pdfgen import canvas # 20220513 add for make pdf
from reportlab.lib.pagesizes import A4, portrait # 20220513 add for make pdf

from reportlab.pdfgen import canvas 

output = BytesIO()
c = canvas.Canvas(output)
c.drawString(10, 800, "Hello World Page 1")
# 画像ファイルの挿入
#c.drawImage(b, 200, 500)
c.drawString(10, 800, "Hello World Page 2")
# 四角形の描画
c.rect(200, 200, 100, 50)
# 塗りつぶした四角形の描画
c.setFillColorRGB(1.0, 0.5, 0.3)
c.rect(300, 300, 100, 50, fill=True)

self.save_pdf_report.filename = 'try_change_to.pdf'
self.save_pdf_report.file = output
print ('try_end')