
Hai all,
I need code to open a pdf file in same jsp page(browser) while click on hyperlink
And the file was located in database table.
Can any one help me
Regards, Divya

<%@page import="java.io.*"%>
<%@page import="java.sql.*"%>
<%@page import="com.lowagie.text.*"%>
<%@page import=" com.lowagie.text.pdf.*"%>
<%
Document document=new Document();
PdfWriter.getInstance(document,new FileOutputStream("C:/data.pdf"));
document.open();
PdfPTable table=new PdfPTable(2);
table.addCell("Name");
table.addCell("Address");
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("Select * from data");
while(rs.next()){
table.addCell(rs.getString("name"));
table.addCell(rs.getString("address"));
}
document.add(table);
document.close();
%>
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.