i am using javascript to print a pdf. when i click on print button,the pdf is generated nd saved somewhere and after that javascript code runs. This javascript opens the pdf and closes it(opens for a fraction of second) and then again open the same pdf with printer popup screen. I want to remove the step where the pdf is opened and closed. i want the pdf should open only onces.

i am using window.open();

thanks,

Recommended Answers

All 3 Replies

full code is required,to give any reasoned answer

JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(),
"printWindow  = window.open('."+tempFileName+"','myWindow');" +         		"printWindow.print(); " );

"tempFileName" is the file location.

Not sure... Have you tried

window.open('."+tempFileName+"','myWindow').print()

instead of assign window.open to printWindow, and then call print()?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.