Java Netbeans : create a simple report in PDF using itext part 2 | Pdf Table

preview_player
Показать описание

Download link of PDF Reader:

Jump to 1st part of the tutorial:

Subscribe my Channel:
Комментарии
Автор

how to add column, lines and header in it ?can u show in next tutorial ?

charlesakou
Автор

how do I generate a dynamic pdf in packaged application?

austineadah
Автор

The source code is here... enjoy :D

import com.itextpdf.text.Document;
import
import com.itextpdf.text.Paragraph;
import
import
import
import java.io.FileOutputStream;
import java.sql.*;
import java.sql.ResultSet;
public class PDFReport {
public static void main(String ar[]) throws ClassNotFoundException, SQLException, DocumentException, FileNotFoundException
{
int rowno=0;

Connection
Statement st=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rs=st.executeQuery("select * from visitor");
ResultSetMetaData rsmd=rs.getMetaData();
int colno=rsmd.getColumnCount();

while(rs.next())
{
rowno=rowno+1;
}
rs.first();

//System.out.print(""+rowno);
Document d=new Document();
PdfWriter.getInstance(d, new
PdfPTable pt=new PdfPTable(colno);
d.open();
d.add(new Paragraph("Visitor Report"));
for(int i=0;i<rowno;i++)
{





rs.next();
}


d.add(pt);
d.close();

}
}

UnpossiblePOG
Автор

but the link pdf reader doesn't work or umpty !

charlesakou