java - how to view pdf file in tiny box in jsp -


i want view pdf file in tiny box in jsp out option download,view.please give java source example

file f= new file(file); if(f.exists()){ servletoutputstream op= response.getoutputstream(); response.reset(); if(check==1){ response.setcontenttype("application/pdf"); }else{ response.setcontenttype(content);           } // response.setheader("content-disposition","attachment; filename=" +filename); byte[] buf = new byte[4096]; int length; datainputstream in = new datainputstream(new fileinputstream(f)); while ((in != null) && ((length = in.read(buf)) != -1)){ op.write(buf,0,length);                 } in.close(); op.flush(); op.close(); }  , done download pdf file use code  

you can use pdfobject. need javascript. can use object tag follows

<object data="yourfile.pdf" type="application/pdf" width="100%" height="100%">   <p>alternative text - include link <a href="yourfile.pdf">yourfile</a></p> </object> 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -