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



Home Answers Viewqa Java-Beginners Create PDF from java
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


hendra
Create PDF from java
2 Answer(s)      3 years and 8 months ago
Posted in : Java Beginners


Good afternoon,

I have a problem how to create report. i want to create report in pdf file from my database in mysql. Now i use IReport too create pdf file, can't work...., pleas tell me a tutorial/source code to create pdf file from database call from java programming.

thank you,

Hendra


Advertisement
View Answers

February 14, 2011 at 3:43 PM


Create PDF from Java

import java.io.*;
import java.sql.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;

public class CreatePDF{
    public static void main(String arg[])throws Exception{
       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();
   }
}

For more information, visit the following link:

Itext Examples



February 16, 2011 at 1:17 PM


i have a problem again, please help me again....., i have a case, where my data is much field. i have 12 field, and my data have 10-30 character and more in 1 field. can you help me how to resize my data is good looking if i print in pdf. maybe make a landscape preview, thank you



Related Tutorials/Questions & Answers:
Create PDF from java
code to create pdf file from database call from java programming. thank you, Hendra   Create PDF from Java import java.io.*; import java.sql....Create PDF from java  Good afternoon, I have a problem how to create
create pdf from jsongrid
create pdf from jsongrid  i need to create pdf from jsongrid in java struts2.. otherwise i need to create pdf from result set
Advertisements
how to create pdf file using java and itextjar
how to create pdf file using java and itextjar  How to create pdf file having paragraphs and alignments done using java and itextjar 5.10 version.? hope i get quick response
how to create pdf file using java and itextjar
how to create pdf file using java and itextjar  How to create pdf file having paragraphs and alignments done using java and itextjar 5.10 version.? hope i get quick response
reading from pdf to java - Java Beginners
reading from pdf to java  How can i read the pdf file to strings in java. I need the methods of reading data from file and to place that data in the string, using java.   Hi Friend, We are providing you a code
Creating PDF in JAVA
Creating PDF in JAVA  How create pdf in java ? Take value from database for particular PDF
generating itext pdf from java application - Java Beginners
generating itext pdf from java application  hi, Is there any method in page events of itext to remove page numbers from pdf generated frm java application.  Hi friend, Read for more information. http
How to read PDF files created from Java thru VB Script
How to read PDF files created from Java thru VB Script  We have created the PDF file thru APache FOP but when we are unable to read the data thru... file?   Java PDF Tutorials
pdf from i report
pdf from i report  I have a problem again with my report, i use I Report to make pdf file. but when the application running in java, pdf can't view. but in rtf format data can view. or can icon save like this to be dissapear
convert data from pdf to text file - Java Beginners
convert data from pdf to text file   how to read the data from pdf file and put it into text file(.txt
Extarct string from PDF
Extarct string from PDF  how can i search a particular character from pdf? also extarct string from a pdf document
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
reading from pdf
reading from pdf  how can i read specific words from pdf file?   Java Read pdf file import java.io.*; import java.util.*; import com.lowagie.text.*; import com.lowagie.text.pdf.*; public class ReadPDF { public
How to create pdf file in struts2.
How to create pdf file in struts2. In this example, you will see the how to create PDF in struts, and how to write message in generated PDF file in struts2.  For this, we requires a jar file iText.jar. It is used in java
PDF creation in JAVA - JSP-Servlet
PDF creation in JAVA  HI! Good morning.... I want to create pdf file and i want to write something into pdf file....before creation. Upto creation i have done but how to write data into pdf. File Writer is not working
Add Content of an iText PDF File using java code
documents from Java program. The iText is a open source library that provide facility to create pdf file from java application. iText is a freely available Java... Add Content of an iText PDF File using java code  
Extracting position of a particular string from a PDF
Extracting position of a particular string from a PDF  I have a pdf form. I want to knw the exact position(location) of a particular string of that form. Using iText I have extracted all the string from the PDF form, but nt able
how to generate the pdf report from jsp
how to generate the pdf report from jsp  <%@page import... want to generate the pdf file from jsp page.I add the itext.jar to the libraries... not getting the pdf file.Any one please help me asap.Its very important
PDF to Word Conversion - Java Beginners
PDF to Word Conversion  Hello, Can we convert a PDF document to Microsoft word document thru Java. If its not possible in Java, is it possible in any other language
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... implementing this, is there any source code in java? Thanks
how to create xml schema from xml doc using java
how to create xml schema from xml doc using java  i want to create xml schema from xml document programatically using java... am using Netbeans IDE 7.0 i hav created the xml document for a table of data from Database... now i
Generate unicode malayalam PDF from JSP
Generate unicode malayalam PDF from JSP   Hi, I want to generate a malayalam report in PDF format.I have generated a report in jsp.Now I want the same report to be saved as PDF in unicode malayalam font.I have tried to generate
java code to create xml document from DOM object
java code to create xml document from DOM object  Hey! After knowing the way we can create DOM objects and add elements to it-> then displaying it on the console ;is there a way I can output the same in xml document
Create Bar Graph from reading excel sheet in Java
Create Bar Graph from reading excel sheet in Java  I'm New to Java and I have to create a java program where I have to read data from multiple excel sheets say 4 sheets and sheet represents browsers (like FF, IE8, IE9 , chrome
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
Displaying html code in pdf with itext - Java Beginners
Displaying html code in pdf with itext   Hi , I am geeting data which was enterd from fck editor. same data is stored in the database i need to display this data in the pdf . i am using itext to create
how to add the scrollbar to the pdf page when generating the pdf file from jsp - JSP-Servlet
how to add the scrollbar to the pdf page when generating the pdf file from jsp  I am not able to see all the columns when i generated the pdf file from jsp.i have 12 colums so how to add the scrollbar
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
pdf file is having the 0 KB when generate the pdf file from jsp - JSP-Servlet
pdf file is having the 0 KB when generate the pdf file from jsp  Hi Friend, I am getting OKB pdf file .if i inserting the image into pdf file , i am getting the OKB pdf file now and also not able to open the pdf
How to set the pdfptable as pdf page header when generating the pdf from jsp page. - JSP-Servlet
How to set the pdfptable as pdf page header when generating the pdf from jsp page.  how to set the pdfptable column headers as a header of the documet.i need to display the column headers for every pdf page if pdf documt is 20
how to generate the pdf file with scroolbar from jsp age - JSP-Servlet
how to generate the pdf file with scroolbar from jsp age  How to generate the pdf file with scroolbar from jsp.i am not able to see the all the columns in pdf file now .it is very urgent for me plz help
Advertisements
 

 

 

DMCA.com