コード例 #1
0
ファイル: Header.cs プロジェクト: rickyasg/ProyectoX
        public override void OnStartPage(PdfWriter writer, Document document)
        {
            if (DrawHeader)
            {
                base.OnStartPage(writer, document);
                PdfPTable header = new PdfPTable(new float[] { 1, 10, 1 });
                header.WidthPercentage = 100;

                PdfPTable detalle = new PdfPTable(2);
                detalle.AddCell(DrawTable.DrawCellHeader("Nombre:", 8, CellBorder.NONE, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Normal));
                detalle.AddCell(DrawTable.DrawCell(Nombre, 10, CellBorder.NONE, CellAlignment.Middle, CellFontStyle.Normal));

                detalle.AddCell(DrawTable.DrawCellHeader("Unidad:", 8, CellBorder.NONE, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Normal));
                detalle.AddCell(DrawTable.DrawCell(Unidad, 10, CellBorder.NONE, CellAlignment.Left, CellFontStyle.Normal));

                detalle.AddCell(DrawTable.DrawCellHeader("Fecha:", 8, CellBorder.NONE, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Normal));
                detalle.AddCell(DrawTable.DrawCell(Fecha, 10, CellBorder.NONE, CellAlignment.Left, CellFontStyle.Normal));

                detalle.AddCell(DrawTable.DrawCellHeader("Semana:", 8, CellBorder.NONE, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Normal));
                detalle.AddCell(DrawTable.DrawCell(Semana, 10, CellBorder.NONE, CellAlignment.Left, CellFontStyle.Normal));
                detalle.AddCell(DrawTable.DrawCellHeader("Total Horas:", 8, CellBorder.NONE, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Normal));
                detalle.AddCell(DrawTable.DrawCell(Totalhoras, 10, CellBorder.NONE, CellAlignment.Left, CellFontStyle.Normal));
                PdfPCell cellImg;


                LogoIzquierda.ScaleToFit(60f, 60f);
                cellImg        = new PdfPCell(LogoIzquierda);
                cellImg.Border = PdfPCell.NO_BORDER;
                header.AddCell(cellImg);

                PdfPCell tc = new PdfPCell(detalle);

                tc.Border = 0;
                header.AddCell(tc);

                LogoDerecha.ScaleToFit(60f, 60f);
                cellImg        = new PdfPCell(LogoDerecha);
                cellImg.Border = PdfPCell.NO_BORDER;
                header.AddCell(cellImg);

                PdfPTable tp = new PdfPTable(new float[] { 60, 40 });
                tp.AddCell(DrawTable.DrawCellHeader(Titulo, 14, CellBorder.NONE, CellAlignment.Right, CellAlignment.Middle, CellFontStyle.Bold));
                tp.AddCell(DrawTable.DrawCellHeader(Formulario, 5, CellBorder.NONE, CellAlignment.Left, CellAlignment.Bottom, CellFontStyle.Bold));
                document.Add(tp);
                document.Add(header);
                document.Add(DrawTable.Line());
                document.Add(new Paragraph("\n"));
            }
        }
コード例 #2
0
ファイル: Header.cs プロジェクト: rickyasg/ProyectoX
        public override void OnStartPage(PdfWriter writer, Document document)
        {
            if (DrawHeader)
            {
                base.OnStartPage(writer, document);
                PdfPTable header = new PdfPTable(new float[] { 1, 10, 1 });
                header.WidthPercentage = 100;

                PdfPTable detalle = new PdfPTable(2);
                detalle.AddCell(DrawTable.DrawCellHeader("Nombre:", 8, CellBorder.NONE, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Normal));
                detalle.AddCell(DrawTable.DrawCell(Nombre, 10, CellBorder.NONE, CellAlignment.Middle, CellFontStyle.Normal));

                PdfPTable tp = new PdfPTable(new float[] { 70 });
                tp.AddCell(DrawTable.DrawCellHeader(Titulo, 14, CellBorder.NONE, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Bold));
                tp.AddCell(DrawTable.DrawCellHeader(Subtitulo1, 7, CellBorder.NONE, CellAlignment.Center, CellAlignment.Top, CellFontStyle.Normal));
                tp.AddCell(DrawTable.DrawCellHeader(Subtitulo2, 9, CellBorder.NONE, CellAlignment.Center, CellAlignment.Top, CellFontStyle.Bold));

                PdfPCell cellImg;
                LogoIzquierda.ScaleToFit(60f, 60f);
                cellImg        = new PdfPCell(LogoIzquierda);
                cellImg.Border = PdfPCell.NO_BORDER;
                header.AddCell(cellImg);
                PdfPCell tc = new PdfPCell(tp);
                tc.Border = 0;
                header.AddCell(tc);

                LogoDerecha.ScaleToFit(60f, 60f);
                cellImg        = new PdfPCell(LogoDerecha);
                cellImg.Border = PdfPCell.NO_BORDER;
                header.AddCell(cellImg);

                document.Add(header);
                document.Add(DrawTable.Line());
                document.Add(new Paragraph("\n"));
            }
        }