I have a dashboard in Pentaho CDE that has several buttons to print diferent charts in Excel and PDF.

Nowadays PDF button calls a prpt report with diferent parameters and opens a new window to generate it.

I have this function in PDF button:

function f(){

But I need that PDF generate and download directly without open a new window.

I tried with iframes (In excel working) but not working in PDF, I tried with download function in html5 but download a html file.... I read that is possible with phantomjs... but I'm not sure...