How does the Print PDF button works in vanguard report?

I am making a dashboard app and I want to add the Print PDF button just like report, can anyone please explain its working ?

If you look at the source code at

you will find links to various external resources including

The JavaScript file calls window.print() when the button is clicked, and the css file sets up the print layout in @media print.


This example code is not available anymore :frowning:

1 Like

You can print pdf like this:

  1. install this package python -m pip install visdcc
  2. import visdcc
  3. Add these lines in the layout

html.Button(“Download”, id=“click1”),
visdcc.Run_js(id = ‘javascript’)

  1. add callback

Output(‘javascript’, ‘run’),
[Input(‘click1’, ‘n_clicks’)])

def myfun(x):
if x:
return “window.print()”
return “”

  1. save it, run the code and click download button. It will work 100%