open pdf file in same jsp page and the pdf file should retrieved from database

Ads
 

open pdf file in same jsp page and the pdf file should retrieved from database

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

View Answers

November 18, 2011 at 2:56 PM

<%@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();
       %>

Ads









Related Tutorials/Questions & Answers:
open pdf file in same jsp page and the pdf file should retrieved from database
open pdf file in same jsp page and the pdf file should retrieved from database  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
openning the pdf or doc file in same jsp
openning the pdf or doc file in same jsp   **how to open the pdf and doc file in same jsp after clicking the link or button (which is with out moving to the next page). will some body help me on this @simple format please
Advertisements
pdf file in jsp
pdf file in jsp  i have a pdf, which has to be displayed in a jsp page along with some html tags, the pdf which is to be displayed shold be readonly and wont allow the uer to save too
The type Font is ambiguous where generating pdf file from jsp page - JSP-Servlet
The type Font is ambiguous where generating pdf file from jsp page  I am geeting ambiguous error .Do u want to add any jar files   Hi Friend, Import the class Font into your JSP page like the following
write data to a pdf file when i run jsp page
to the libraries.the pdf file are not opened when i execute the program.please send the code to open the pdf file when i execute the jsp page...write data to a pdf file when i run jsp page  Hi, <%@page import
write data to a pdf file when i run jsp page
to the libraries.the pdf file are not opened when i execute the program.please send the code to open the pdf file when i execute the jsp page...write data to a pdf file when i run jsp page  Hi, <%@page import
write data to a pdf file when i run jsp page
to the libraries.the pdf file are not opened when i execute the program.please send the code to open the pdf file when i execute the jsp page...write data to a pdf file when i run jsp page  Hi, <%@page import
write data to a pdf file when i run jsp page
to the libraries.the pdf file are not opened when i execute the program.please send the code to open the pdf file when i execute the jsp page...write data to a pdf file when i run jsp page  Hi, <%@page import
Generate pdf file - JSP-Servlet
Generate pdf file   Hi Friends, How to generate the pdf file for the jsp page or in servets  Hi Friend, You need to download itext api. After that set the classpath and try the following code
pdf generate from jsp
pdf generate from jsp  how do i generate a pdf using jsp that should query the data from the database and write it into a pdf and download the same
display multiple image file or pdf file in multiple column of a row from server or database
display multiple image file or pdf file in multiple column of a row from server... want to display that file to the user page but I want to display that file... uploading more files then uploaded file should be display again tow file in another row
Uploading and download pdf or .txt file.
Uploading and download pdf or .txt file.  I want admin user to upload pdf file into database and the users can download those pdf format from database
Download PDF file
Download PDF file  How to download PDF file with JSF
How to generate pdf file on click of the links using jsp..
How to generate pdf file on click of the links using jsp..  How to generate the pdf file using jsp file. Generate table in pdf by using jsp.   Here is an example that will generate a pdf file into c drive.The pdf file
about pdf file handeling
about pdf file handeling  can i apend something in pdf file using... to handle pdf files. You can find the related examples from the given link: Handling PDF files
displaying data retrieved from a database in a jsp page
displaying data retrieved from a database in a jsp page  the page should display username, emailid, telephone in addition to tthe tagline however... sql = "select billid, customerid, billdate, status from customerbills where
about pdf file handeling
about pdf file handeling  i have downloaded a jar file containing packages for writing in pdf files . in which folder i should copy it ? i'm using windowsXP os.pls give whole path
How to generate the pdf file using jsp - JSP-Servlet
How to generate the pdf file using jsp  Hi how to generate the pdf file in jsp  Hi Friend, Try the following code: Thanks
pdf to database
pdf to database  Hi, I want to read the data from pdf(pdf file is having 50 fields) which is placed in database file and store that into MySQL database. I want this process untill the rows completed in the database file
Convert Text File to PDF file
Convert Text File to PDF file  Here is the way how to covert your Text file to PDF File, public class TextFileToPDF { private static void...(inLine); System.out.println("Text is inserted into pdf file
Java code to convert pdf file to word file
Java code to convert pdf file to word file  How to convert pdf file to word file using Java
how read data from doc file in same formate in jsp
how read data from doc file in same formate in jsp  how we can read and display data on jsp page, from doc file with the same formatting
convert an pdf file to html in Java
convert an pdf file to html in Java  Hi all, How to convert an pdf file to html in Java? Currently all my data is generated into a report in pdf and i want to be able to generate it to html page as well. How to go about
Convert Text File to PDF file
Convert Text File to PDF file  import java.io.BufferedReader; import...); System.out.println("Text is inserted into pdf file"); document.close... FileReader( Input File)); String inLine = null
how to generate pdf file in struts
how to generate pdf file in struts  I am developing a struts... are stored in database,the database name is registration. In another form i am having a button, by clicking that button the registration database values should
how to generate pdf file in struts
how to generate pdf file in struts  I am developing a struts... are stored in database,the database name is registration. In another form i am having a button, by clicking that button the registration database values should
generate pdf using jsp
generate pdf using jsp  how do i generate a pdf using jsp that should query the data from the database and write it into a pdf and download the same
Write Hello in the pdf file
Write Hello in the pdf file     ...;Hello" word in a pdf file irrespective of the fact whether it exists...*, and com.lowagie.text.*. These two package will help us to make and use pdf file in our program. Now
need to open a file that is in server using jsp
is just want to open a pdf in jsp.is it possible to open sever file from jsp.Plz...need to open a file that is in server using jsp   im doing a web application where i can upload and download pdf files from server.in this i created
how to generate PDF file using JSP with net beans
how to generate PDF file using JSP with net beans  I am trying to generate PDF file using JSP. I even added itext5.0.6 jar file in library. It shows...: Compiling 1 source file to C:\Documents and Settings\Administrator\My Documents
read restricted pdf file
read restricted pdf file  i have restricted file. package Encryption; import java.io.*; import java.util.*; import com.lowagie.text.*; import...()); } } } pdf given to code is in marathi it gives following output

Ads