I have class which generates pdf report. The report is generated as stream as
I donot want to save the file in server. I need to show the pdf in the
browser. But the link provided to this dynamically generated pdf opens a new
window and asks for saving the file. How to open the pdf in new window?

My piece of code:

IResourceStream stream1 = new ByteArrayResource("application/pdf",
stream.toByteArray()).getResourceStream();                      
getRequestCycle().setRequestTarget(new
ResourceStreamRequestTarget(stream1).setFileName("eFile.pdf"));

The stream here is the stream to which the pdf is written. I also tried the
following code. But this gives null pointer exception

getRequestCycle().setRequestTarget(new RedirectRequestTarget(urlFor(new
ResourceStreamRequestTarget(stream1).setFileName("eFile.pdf")).toString()));

Any help will be great. Thanks in advance.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-show-pdf-ByteArrayResouce-in-browser-tp3320759p3320759.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to