Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Framework how to print pdf format
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


tulasi.vishnu
how to print pdf format
3 Answer(s)      2 years and 6 months ago
Posted in : Framework


Hi every body iam doing school project iam using backend as oracle front end java .how to print student marks list /attendence in pdf format. please help me. thanks in advance.


Advertisement
View Answers

June 23, 2012 at 4:28 PM


Here is a code that will store the database data into pdf table. We have used itext api:

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


June 23, 2012 at 6:22 PM


thanks alot



December 17, 2012 at 12:33 PM


hey bro, need little help in this. it prints all records in pdf. i want only the displayed results from resultset to be printed in pdf...ofcourse there will be "where" clause in sql query ..but am not getting as how should i use that where clause in sql. please help ASAP! thanks in advance.



Related Tutorials/Questions & Answers:
how to print pdf format
how to print pdf format  Hi every body iam doing school project iam using backend as oracle front end java .how to print student marks list /attendence in pdf format. please help me. thanks in advance.   Here
How to print this Format exactly?
How to print this Format exactly?   * * * & reverse
Advertisements
how to display the database values in pdf format
how to display the database values in pdf format   in struts how to display the values in pdf format when clicking a button in jsp page   jsp code using itext api: <%@page import="java.io.*"%> <%@page import
pdf format - JSP-Servlet
pdf format  hi Sir, how to convert text format into PDF format. thanks & regards, vijayababu.m
Print the following format
Print the following format  how to print the following format given string "00401121" in java 0-** 1-* 2-* 3- 4
print array in following format
print array in following format  i want print two array in following format first array= 1,2,3,4,5,6,7,8,9 second array=11,12,13,14,15,16,17,18,19 i want output as: 1 2 3 11 12 13 4 5 6 14 15 16 7 8 9 17 18 19  
Displaying database values in pdf format
database values should be shown as pdf or excel format. Thanks in advance...Displaying database values in pdf format  Hi All, I am developing a struts application.I am having one registration form when i am submitting
To save table format data in pdf/excel in jsp
To save table format data in pdf/excel in jsp  Hello, I am doing web... table. So my question is ,I want so save this html format data in pdf/excel format... can save html table data in pdf/excel format.Your inputs are valuable to me
Print pdf file in JavaScript - IE and Chrome
Print pdf file in JavaScript - IE and Chrome  <!DOCTYPE html>...') { //Wait until PDF is ready to print if (typeof...; PRINT PDF IN IE AND CHROME <table> <tr> <td> <
how to load pdf on html
how to load pdf on html  how to load pdf on html
Print pdf file in JavaScript - IE and Chrome
Print pdf file in JavaScript - IE and Chrome   <!DOCTYPE html>...') { //Wait until PDF is ready to print if (typeof...; PRINT PDF IN IE AND CHROME <table> <tr> <td> <
how to print the server time
how to print the server time  how to print the server time in jsp and update time in fix interval
How create csv format in jsf ?
How create csv format in jsf ?  Dear Friends , Good morning to all of you? I have a problem to create .CSV format in jsf. Actully I have... the pdf file now I want to create .csv format using this data ? Please Help me
how to generate pdf file in struts
how to generate pdf file in struts  I am developing a struts application.I am having one registration form when i am submitting the form the values... be shown as pdf or excel format
how to generate pdf file in struts
how to generate pdf file in struts  I am developing a struts application.I am having one registration form when i am submitting the form the values... be shown as pdf or excel format
How to print this in java?
How to print pattern in Java?  How to print a particular pattern in Java...;  How to print this in java
how to print the server time
how to print the server time  i want to print database time in clintside and update time in every secound without creating connection to database for each time. how can i do
how can i display a pdf file in a jtextarea
how can i display a pdf file in a jtextarea  I need to display a pdf... have a button and while clicking on it ,i need to choose the pdf file and need to displat it in my jframe.Also i need to edit it and i have to take the print
how to print - Java Beginners
how to print  how to print something on console without using System.out.print() method ?  Hi Friend, You can use PrintWriter to write anything on the console. import java.io.*; public class Print{ public static
how to print the following pattern
how to print the following pattern  Hello hEllo heLlo helLo hellO pls reply soon its an emergency   class StringPattern { public static void main(String[] args) { String st="hello
How to get the position of the comments in the pdf
How to get the position of the comments in the pdf  how to get the postion of comments, in the extracted xml, from pdf
How to get the position of the comments in the pdf
How to get the position of the comments in the pdf  how to get the postion of comments, in the extracted xml, from pdf
how to dispaly pdf file on browser
how to dispaly pdf file on browser  In my project i have created one pdf file(by pdfwriter) into my local mechine . after that it need to display in browser as a pdf file . but in jsp i can't display by tag can anyone give me
How to design a foot print on the sand, print on the sand, print
How to design a foot print on the sand       You might have seen foot prints on the sand field. Do you think, it can be design in the photoshop, yes I have done here. I have used
how to display pdf file on browser
how to display pdf file on browser   In my project i have created one pdf file(by pdfwriter) into my local mechine . after that it need to display in browser as a pdf file . but in jsp i can't display by iframe tag can anyone
Insert pages pdf
Insert pages pdf       In this program we..., com.lowagie.text.pdf.PdfWriter class is used to write the document on a pdf file,. To make the program for changing the pdf version firstly we will make
how to print JInternal frame component ?
how to print JInternal frame component ?  hello sir, i devalop a swing application .but problem is that how display report & print it. some data prefech from database & keep to jtable but how it is print with table
How to convert a swing form to PDF
How to convert a swing form to PDF  Sir, I want to know about how convert a swing form containing textbox,JTable,JPanel,JLabel, Seperator etc swing menus to a PDF file using java code
How can print integer in method
How can print integer in method   a method call process public process(int jobid,int remain){ } how to print int jobid ,int remain in for loop jobid in proc[0],remain in proc[1],both show in text file how to print proc[0
How to print the following pattern in java?
How to print the following pattern in java?  How to print the following pattern in java? he he is he is going he is going in   import java.io.*; class StringPattern { public static void main(String[] args
How to convert EBCDIC format value into ASCII format value in java
How to convert EBCDIC format value into ASCII format value in java  how to convert EBCDIC data format into ASCII format data using java Use Case:I my file contains ASCII format values as well as EBCDIC format values.I need
 

 

 

DMCA.com