1

Opening PDF in another Browser Tab

asked 2014-09-17 16:27:29 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2611 3 8
http://emrpms.blogspot.in...

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);
delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-09-20 10:46:48 +0800

Darksu gravatar image Darksu
1991 1 4

updated 2014-09-21 12:33:00 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

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

link publish delete flag offensive edit

Comments

Thank you Darksu

Senthilchettyin ( 2014-09-20 13:24:52 +0800 )edit

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
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-09-17 16:27:29 +0800

Seen: 65 times

Last updated: Sep 21 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More