Este es el codigo para crear lun PDF a traves de JSP utilizando DREAMWEAVER
primero genera un juego de registro y luego inserta el codigo que te falta, este es solo una guia...te puede ayudar un buen extrae todo lo que haya en la BD es de cir genera un reporte general...
Pero si sabes como generarlo de manera indivudual, es decir por registro que se encuentre en la BD me dices como, Salu2
<%@ page
language="java"
import="java.io.*,java.sql.*,com.lowagie.text.*,com.lowagie.text.pdf.*,java.awt.Color"
contentType="text/html; charset=utf-8"
errorPage=""
%><%@ include file="../Connections/gtech.jsp"%><%
Driver Driverrs_stock = (Driver)Class.forName(MM_gtech_DRIVER).newInstance();
Connection Connrs_stock = DriverManager.getConnection(MM_gtech_STRING,MM_gtech_USERNAME,MM_gtech_PASSWORD);
PreparedStatement Statementrs_stock = Connrs_stock.prepareStatement("SELECT * FROM gtech_des.stock ORDER BY FECHA_STOCK ASC");
ResultSet rs_stock = Statementrs_stock.executeQuery();
boolean rs_stock_isEmpty = !rs_stock.next();
boolean rs_stock_hasData = !rs_stock_isEmpty;
Object rs_stock_data;
int rs_stock_numRows = 0;
int Repeat1__numRows = -1;
int Repeat1__index = 0;
rs_stock_numRows += Repeat1__numRows;
String subtitulo="LVT";
String titulo="Reporte de STOCK";
String autor="GTECH CORPORATION";
int numero=0;
response.setContentType("application/pdf");
Document document=new Document();
ByteArrayOutputStream buffer=new ByteArrayOutputStream();
PdfWriter.getInstance(document, response.getOutputStream());
document.addAuthor(autor);
document.addCreator("Despacho");
document.addTitle("Reporte de STOCK");
document.addSubject("Reporte de STOCK");
document.open();
float[] widths1={1f};
PdfPTable table1=new PdfPTable(widths1);
PdfPCell cell1=new PdfPCell(new Paragraph(titulo));
cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
cell1.setBorderColor(new Color(255,255,255));
table1.addCell(cell1);
PdfPCell cell2=new PdfPCell(new Paragraph(subtitulo));
cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
cell2.setBorderColor(new Color(255,255,255));
table1.addCell(cell2);
table1.setWidthPercentage(100);
table1.setSpacingAfter(20f);
document.add(table1);
float[] widths2={0.30f,0.31f,0.31f,0.30f,0.31f,0.31f,0.30f,0.31f,0.31f,0.30f};
PdfPTable table2=new PdfPTable(widths2);
table2.addCell("Tecnico");
table2.addCell("Ciudad");
table2.addCell("Fecha");
table2.addCell("Cantidad de LVT");
table2.addCell("Serie LVT 1");
table2.addCell("Serie LVT 2");
table2.addCell("Serie LVT 3");
table2.addCell("Serie LVT 4");
table2.addCell("Serie LVT 5");
table2.addCell("Serie LVT 6");
while ((rs_stock_hasData)&&(Repeat1__numRows-- != 0)) {
table2.addCell( String.valueOf((((rs_stock_data = rs_stock.getObject("NOM_TEC"))==null || rs_stock.wasNull())?"":rs_stock_data)));
table2.addCell( String.valueOf((((rs_stock_data = rs_stock.getObject("CIU_TEC"))==null || rs_stock.wasNull())?"":rs_stock_data)));
table2.addCell( String.valueOf((((rs_stock_data = rs_stock.getObject("FECHA_STOCK"))==null || rs_stock.wasNull())?"":rs_stock_data)));
table2.addCell( String.valueOf((((rs_stock_data = rs_stock.getObject("CAN_LVT"))==null || rs_stock.wasNull())?"":rs_stock_data)));
table2.addCell( String.valueOf((((rs_stock_data = rs_stock.getObject("NOSERIE_LVT"))==null || rs_stock.wasNull())?"":rs_stock_data)));
table2.addCell( String.valueOf((((rs_stock_data = rs_stock.getObject("NOSERIE2_LVT"))==null || rs_stock.wasNull())?"":rs_stock_data)));
table2.addCell( String.valueOf((((rs_stock_data = rs_stock.getObject("NOSERIE3_LVT"))==null || rs_stock.wasNull())?"":rs_stock_data)));
table2.addCell( String.valueOf((((rs_stock_data = rs_stock.getObject("NOSERIE4_LVT"))==null || rs_stock.wasNull())?"":rs_stock_data)));
table2.addCell( String.valueOf((((rs_stock_data = rs_stock.getObject("NOSERIE5_LVT"))==null || rs_stock.wasNull())?"":rs_stock_data)));
table2.addCell( String.valueOf((((rs_stock_data = rs_stock.getObject("NOSERIE6_LVT"))==null || rs_stock.wasNull())?"":rs_stock_data)));
rs_stock_hasData = rs_stock.next();
}
table2.setWidthPercentage(100);
table2.setSpacingAfter(100f);
table2.setSpacingAfter(100f);
table2.setWidthPercentage(100);
table2.setWidthPercentage(100);
table2.setSpacingAfter(100f);
table2.setSpacingAfter(100f);
table2.setWidthPercentage(100);
table2.setSpacingAfter(100f);
table2.setWidthPercentage(100);
document.add(table2);
document.close();
rs_stock.close();
Statementrs_stock.close();
Connrs_stock.close();
DataOutput output=new DataOutputStream(response.getOutputStream());
byte[] bytes=buffer.toByteArray();
response.setContentLength(bytes.length);
for(int i=0;i<bytes.length;i++){output.writeByte(bytes[i]);}
%>