public override void OnStartPage(PdfWriter writer, Document document)
{
base.OnStartPage(writer, document);
if ((tipoDocumento == "contrato") || (tipoDocumento == "contrato_preimpreso")) //no se ponen cabeceras ni fotter
{
}
else
{
if (tipoDocumento == "clausula")
{
//imagen de la cabecera
float escala = 85; //%
Image imagenHeader = Image.GetInstance(dirImagenHeader);
imagenHeader.ScalePercent(escala);
PdfPTable table = new PdfPTable(1);
table.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin;
//logo
PdfPCell cell = new PdfPCell(imagenHeader);
cell.Border = 0;
cell.BorderWidth = 0;
table.AddCell(cell);
table.WriteSelectedRows(0, -1, document.LeftMargin, document.PageSize.Height - 20, writer.DirectContent);
}
else
{
if (tipoDocumento == "apertura_cuenta")
{
//imagen de la cabecera
float escala = 70; //%
Image imagenHeader = Image.GetInstance(dirImagenHeader);
imagenHeader.ScalePercent(escala);
PdfPTable table = new PdfPTable(1);
table.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin;
//logo
PdfPCell cell = new PdfPCell(imagenHeader);
cell.Border = 0;
cell.BorderWidth = 0;
table.AddCell(cell);
table.WriteSelectedRows(0, -1, document.LeftMargin, document.PageSize.Height - 90, writer.DirectContent);
}
else
{
if (tipoDocumento == "autos_recomendacion")
{
//imagen de la cabecera
float escala = 70; //%
Image imagenHeader = Image.GetInstance(dirImagenHeader);
imagenHeader.ScalePercent(escala);
PdfPTable table = new PdfPTable(1);
table.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin;
//logo
PdfPCell cell = new PdfPCell(imagenHeader);
cell.Border = 0;
cell.BorderWidth = 0;
table.AddCell(cell);
table.WriteSelectedRows(0, -1, document.LeftMargin, document.PageSize.Height - 20, writer.DirectContent);
}
else
{
if (tipoDocumento == "orden_compra")
{
//imagen de la cabecera
float escala = 70; //%
Image imagenHeader = Image.GetInstance(dirImagenHeader);
imagenHeader.ScalePercent(escala);
PdfPTable table = new PdfPTable(1);
table.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin;
//logo
PdfPCell cell = new PdfPCell(imagenHeader);
cell.Border = 0;
cell.BorderWidth = 0;
table.AddCell(cell);
table.WriteSelectedRows(0, -1, document.LeftMargin, document.PageSize.Height - 20, writer.DirectContent);
}
else
{
if (tipoDocumento == "entrevista")
{
//imagen de la cabecera
float escala = 85; //%
Image imagenHeader = Image.GetInstance(dirImagenHeader);
imagenHeader.ScalePercent(escala);
PdfPTable table = new PdfPTable(1);
table.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin;
//logo
PdfPCell cell = new PdfPCell(imagenHeader);
cell.Border = 0;
cell.BorderWidth = 0;
table.AddCell(cell);
table.WriteSelectedRows(0, -1, document.LeftMargin, document.PageSize.Height - 20, writer.DirectContent);
}
else
{
if (tipoDocumento == "referencia")
{
//imagen de la cabecera
float escala = 80; //%
Image imagenHeader = Image.GetInstance(dirImagenHeader);
imagenHeader.ScalePercent(escala);
PdfPTable table = new PdfPTable(1);
table.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin;
//logo
PdfPCell cell = new PdfPCell(imagenHeader);
cell.Border = 0;
cell.BorderWidth = 0;
table.AddCell(cell);
table.WriteSelectedRows(0, -1, document.LeftMargin, document.PageSize.Height - 20, writer.DirectContent);
}
else
{
if (tipoDocumento == "afiliaciones")
{
//imagen de la cabecera
float escala = 85; //%
Image imagenHeader = Image.GetInstance(dirImagenHeader);
imagenHeader.ScalePercent(escala);
PdfPTable table = new PdfPTable(1);
table.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin;
//logo
PdfPCell cell = new PdfPCell(imagenHeader);
cell.Border = 0;
cell.BorderWidth = 0;
table.AddCell(cell);
table.WriteSelectedRows(0, -1, document.LeftMargin, document.PageSize.Height - 20, writer.DirectContent);
}
else
{
if (tipoDocumento == "manualServicio")
{
int pageN = writer.PageNumber;
Image imagenHeader = Image.GetInstance(dirImagenHeader);
imagenHeader.ScaleToFit(100, 100);
//imagenHeader.ScalePercent(escala);
PdfPTable table = new PdfPTable(5);
table.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin;
Font fuente = new Font(Font.FontFamily.HELVETICA, 9);
PdfPCell cell = new PdfPCell(imagenHeader);
cell.Colspan = 2;
cell.Padding = 3;
cell.Border = 1;
cell.BorderWidthBottom = 1;
cell.BorderWidthLeft = 1;
cell.BorderWidthRight = 1;
cell.BorderWidthTop = 1;
cell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
cell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
table.AddCell(cell);
PdfPCell cell1 = new PdfPCell(new Phrase("PROCESO GESTIÓN COMERCIAL", fuente));
cell1.Colspan = 3;
cell1.Padding = 3;
cell1.Border = 1;
cell1.BorderWidthBottom = 1;
cell1.BorderWidthLeft = 1;
cell1.BorderWidthRight = 1;
cell1.BorderWidthTop = 1;
cell1.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
cell1.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
table.AddCell(cell1);
PdfPCell cell2 = new PdfPCell(new Phrase("MANUAL DE SERVICIO", fuente));
cell2.Colspan = 5;
cell2.Padding = 3;
cell2.Border = 1;
cell2.BorderWidthBottom = 1;
cell2.BorderWidthLeft = 1;
cell2.BorderWidthRight = 1;
cell2.BorderWidthTop = 1;
cell2.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
cell2.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
table.AddCell(cell2);
PdfPCell cell3 = new PdfPCell(new Phrase("FECHA DE EMISIÓN\n" + DateTime.Now.ToShortDateString(), fuente));
//cell3.Colspan = 5;
cell3.Padding = 3;
cell3.Border = 1;
cell3.BorderWidthBottom = 1;
cell3.BorderWidthLeft = 1;
cell3.BorderWidthRight = 1;
cell3.BorderWidthTop = 1;
cell3.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
cell3.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
table.AddCell(cell3);
PdfPCell cell4 = new PdfPCell(new Phrase("VERSION:\n" + versionManual, fuente));
cell4.Colspan = 2;
cell4.Padding = 3;
cell4.Border = 1;
cell4.BorderWidthBottom = 1;
cell4.BorderWidthLeft = 1;
cell4.BorderWidthRight = 1;
cell4.BorderWidthTop = 1;
cell4.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
cell4.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
table.AddCell(cell4);
PdfPCell cell5 = new PdfPCell(new Phrase("APLICA A PARTIR:\n" + fechaApartirDe.ToShortDateString(), fuente));
//cell4.Colspan = 2;
cell5.Padding = 3;
cell5.Border = 1;
cell5.BorderWidthBottom = 1;
cell5.BorderWidthLeft = 1;
cell5.BorderWidthRight = 1;
cell5.BorderWidthTop = 1;
cell5.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
cell5.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
table.AddCell(cell5);
PdfPCell cell6 = new PdfPCell(new Phrase("PAGINA " + pageN.ToString(), fuente));
//cell4.Colspan = 2;
cell6.Padding = 3;
cell6.Border = 1;
cell6.BorderWidthBottom = 1;
cell6.BorderWidthLeft = 1;
cell6.BorderWidthRight = 1;
cell6.BorderWidthTop = 1;
cell6.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
cell6.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
table.AddCell(cell6);
table.WriteSelectedRows(0, -1, document.LeftMargin, document.PageSize.Height - 20, writer.DirectContent);
}
else
{
if (tipoDocumento == "entrevista_retiro")
{
//imagen de la cabecera
float escala = 85; //%
Image imagenHeader = Image.GetInstance(dirImagenHeader);
imagenHeader.ScalePercent(escala);
PdfPTable table = new PdfPTable(1);
table.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin;
//logo
PdfPCell cell = new PdfPCell(imagenHeader);
cell.Border = 0;
cell.BorderWidth = 0;
table.AddCell(cell);
table.WriteSelectedRows(0, -1, document.LeftMargin, document.PageSize.Height - 20, writer.DirectContent);
}
else
{
if (tipoDocumento == "apertura_cuenta_avvillas")
{
//imagen de la cabecera
float escala = 70; //%
Image imagenHeader = Image.GetInstance(dirImagenHeader);
imagenHeader.ScalePercent(escala);
PdfPTable table = new PdfPTable(1);
table.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin;
//logo
PdfPCell cell = new PdfPCell(imagenHeader);
cell.Border = 0;
cell.BorderWidth = 0;
table.AddCell(cell);
table.WriteSelectedRows(0, -1, document.LeftMargin, document.PageSize.Height - 20, writer.DirectContent);
}
}
}
}
}
}
}
}
}
}
}
}