For New Comers, Here is the example in my blog http://emrpms.blogspot.in/2014/09/zk-upload-pdf-to-server-and-show-in.html
Senthilchettyin ( 2014-09-21 15:19:10 +0800 )edit-
FEATURED COMPONENTS
First time here? Check out the FAQ!
The following code opens the pdf file on the same screen from where it is called. But i want to show this PDF in another tab in the browser window
Window win = (Window) Executions.createComponents(
"/zk/main/iframereport.zul", null, null);
Iframe frame = (Iframe) win.getFellow("reportframe");
File f = new File(temp.getAbsolutePath());
byte[] buffer = new byte[(int) f.length()];
FileInputStream fs = new FileInputStream(f);
fs.read(buffer);
fs.close();
ByteArrayInputStream is = new ByteArrayInputStream(buffer);
AMedia amedia = new AMedia(temp.getAbsolutePath(), "pdf",
"application/pdf", is);
frame.setContent(amedia);
Hello Senthilchettyin,
My first proposal would be to use a modal window as shown in the following url:
http://www.zkoss.org/zkdemo/window/modal_dialog
But since you want to show the PDF in a new tab, then you could use:
Executions.sendRedirect("target_url", "_blank");
And set to the url as a parameter the pdf file name, and load the pdf in the target url.
Best Regards,
Darksu
For New Comers, Here is the example in my blog http://emrpms.blogspot.in/2014/09/zk-upload-pdf-to-server-and-show-in.html
Senthilchettyin ( 2014-09-21 15:19:10 +0800 )editAsked: 2014-09-17 16:27:29 +0800
Seen: 73 times
Last updated: Sep 21 '14