impressão de jsp

Olá,
Estou com um problema em uma function dentro de um jsp. Preciso que o relatório seja impresso só uma vez no entanto esta function está imprimindo duas e não sei qual o problema.
A function é essa:

function imprimir(){
shtml = document.getElementById(“printTable”);
html = “

\n”;
html += “\n”;
html += " \n";
html += “\n”;
html += “\n”;
html += " \n";
html += “\n”;
html += “
\n";
html += " \n";
html += " \n";
html += "
“+shtml.innerHTML+”
\n";
html += "
\n";
html += " \n";
html += " \n";
html += "
\n"+shtml.innerHTML+"
\n";
html += "
”;
    document.frame.document.open();
    document.frame.document.write(html);
    document.frame.document.close();
    document.frame.focus();
    
    
    document.frame.print();
    document.all.btnImprimir.style.display = "";

}