public void onStartPage(PdfWriter writer, Document document) {
try {
Rectangle page = document.getPageSize();
PdfPCell imageCell = null;
PdfPCell textCell = null;
PdfPTable head = new PdfPTable(2);
float[] widths = new float[] { 1f, 4f };
head.setWidths(widths);
ServletContext context = ServletActionContext.getServletContext();
String relativeWebPath = "/images/logo_melon.gif";
String absoluteDiskPath = context.getRealPath(relativeWebPath);
Image headImage = Image.getInstance(absoluteDiskPath);
headImage.scaleToFit(75, 75);
imageCell = new PdfPCell(headImage);
imageCell.setBorder(Rectangle.NO_BORDER);
head.addCell(imageCell);
Font catFont = new Font(Font.FontFamily.HELVETICA, 16,
Font.BOLD);
textCell = new PdfPCell(new Phrase("Reporte de Novedades: " + negocio,catFont));
textCell.setBorder(Rectangle.NO_BORDER);
head.addCell(textCell);
head.setTotalWidth(page.getWidth() - document.leftMargin()
- document.rightMargin());
head.writeSelectedRows(0, -1, document.leftMargin(), page
.getHeight()
- document.topMargin() + head.getTotalHeight(), writer
.getDirectContent());
document.add(new Paragraph("\n"));