2015-09-10 85 views
0

我有一個要求tp彈出一個窗口顯示一個pdf頁面,執行無聲打印並關閉相同。執行打印後關閉彈出窗口

 String s = 
     "var win = window.open('PrintPopUp.jsf','_blank',\"height=300,width=200,scrollbars=no," + 
     "status=no, resizable=no, screenx=0, screeny=0\");" + 
"win.onclick= function(){ win.close();}" 

我用上面的代碼來獲取彈出,上打印的點擊我寫這篇文章的代碼我的網頁及以下調用servlet來生成PDF格式;

 FacesContext context = FacesContext.getCurrentInstance(); 
    HttpServletRequest request = (HttpServletRequest)context.getExternalContext().getRequest(); 
    HttpServletResponse response = (HttpServletResponse)context.getExternalContext().getResponse(); 
    RequestDispatcher dispatcher = request.getRequestDispatcher("/hisprintservlet"); 

我的問題是這樣的,我已經能夠彈出窗口中,執行打印靜音但無論我做什麼,在彈出不會關閉。

我正在使用IE 11並且該項目使用ADF 12c。

請幫助..

回答

0

我找到了一個解決方案..我加一個iframe到我的彈出窗口。在body標籤我加入了followingg代碼關閉..

function test(win){if(win==null){alert('null');} else {setTimeout(function(win){this.close();},3000);}} 

這IE11

效果很好
0

結帳彈出窗口上的here文檔。

function showPopup(event) event.cancel(); var source = event.getSource(); var popupid =「popup」; var popup = AdfPage.PAGE.findComponentByAbsoluteId(popupId);

if (!popup.isPopupVisible()) 
{ 
    var hints = {}; 
    hints[AdfRichPopup.HINT_LAUNCH_ID] = source.getClientId(); 
    hints[AdfRichPopup.HINT_ALIGN_ID] = source.getClientId(); 
    hints[AdfRichPopup.HINT_ALIGN] = AdfRichPopup.ALIGN_AFTER_START; 

    popup.show(hints); 
} 

}

功能hidePopup(事件) { event.cancel(); var source = event.getSource(); var popupId = source.getProperty(「popupId」); var isCanceled = source.getProperty(「isCanceled」);

var popup = AdfPage.PAGE.findComponentByAbsoluteId(popupId); 

if (popup.isPopupVisible()) 
{     
    if (isCanceled) 
    popup.cancel(); 
    else 
    popup.hide(); 
} 

} ... ... 的Hello World!

... ...