Пример #1
0
        private PdfPCell TableHeaderWithIcon(string data, string iconName, float w, float h, float t)
        {
            float[]   widths = new float[] { 10f, 30f };
            PdfPTable table  = new PdfPTable(widths);
            Image     icon   = ImageReport.GetDemographicIcon(iconName);

            icon.ScaleToFit(w, h);
            PdfPCell cell1 = new PdfPCell(icon);

            cell1.HorizontalAlignment = Element.ALIGN_RIGHT;
            cell1.PaddingTop          = t;
            cell1.PaddingRight        = 2f;
            cell1.BorderWidth         = 0;
            table.AddCell(cell1);

            PdfPCell  cell = new PdfPCell();
            Paragraph p    = new Paragraph(13);
            Font      lato = FontFactory.GetFont("Lato", 10f);

            lato.Color = new BaseColor(84, 84, 84);

            p.Add(new Chunk(data, lato));
            cell.AddElement(p);
            cell.BorderWidth = 0;
            if (iconName == "Level")
            {
                cell.PaddingTop = -5f;
            }
            table.AddCell(cell);
            PdfPCell cellAll = new PdfPCell(table);

            cellAll.BorderWidth = 0;
            return(cellAll);
        }
Пример #2
0
        // Escribimos el footer del documento
        public override void OnEndPage(PdfWriter writer, Document document)
        {
            base.OnEndPage(writer, document);

            float[] widths = new float[] { 180f, 180f, 180f, 60f };
            footer = new PdfPTable(widths);
            PdfPCell cell1, cell2, cell3;

            footer.TotalWidth = 600F;

            Font lato = FontFactory.GetFont("Lato", 9f);

            lato.Color = BaseColor.GRAY;
            Chunk     chunk = new Chunk("Una solución Brivé ", lato);
            Paragraph p     = new Paragraph();

            p.Add(chunk);
            p.Alignment               = Element.ALIGN_CENTER;
            cell1                     = new PdfPCell(p);
            cell1.BorderWidth         = 0;
            cell1.HorizontalAlignment = Element.ALIGN_CENTER;

            lato.Color = BaseColor.BLACK;
            chunk      = new Chunk("www.evaluatest.com", lato);
            p          = new Paragraph();
            p.Add(chunk);
            p.Alignment               = Element.ALIGN_CENTER;
            cell2                     = new PdfPCell(p);
            cell2.BorderWidth         = 0;
            cell2.HorizontalAlignment = Element.ALIGN_CENTER;

            chunk = new Chunk("Fecha de emisión: " + DateTime.Now.ToString("dd/MM/yyyy"), lato);
            p     = new Paragraph();
            p.Add(chunk);
            p.Alignment               = Element.ALIGN_CENTER;
            cell3                     = new PdfPCell(p);
            cell3.BorderWidth         = 0;
            cell3.HorizontalAlignment = Element.ALIGN_CENTER;

            PdfPCell cell4 = new PdfPCell(new Phrase(writer.PageNumber.ToString(),
                                                     new Font(Font.FontFamily.HELVETICA, 9f, Font.BOLD, BaseColor.BLACK)));

            cell4.HorizontalAlignment = Element.ALIGN_CENTER;
            cell4.BorderWidth         = 0;

            PdfPCell cell0 = new PdfPCell(ImageReport.GetFooter("Logo/drawable-hdpi/footer"));

            cell0.Colspan     = 4;
            cell0.Padding     = 10f;
            cell0.BorderWidth = 0;

            footer.AddCell(cell0);
            footer.AddCell(cell1);
            footer.AddCell(cell2);
            footer.AddCell(cell3);
            footer.AddCell(cell4);

            footer.WriteSelectedRows(0, -1, 5, 50, writer.DirectContent);
        }
Пример #3
0
        private PdfPTable AddImage(string imageName)
        {
            PdfPTable resultTable = new PdfPTable(1);
            Image     image       = ImageReport.GetDemographicIcon("Sections/" + imageName);
            //image.ScaleToFit(37f, 37f);
            PdfPCell cell = new PdfPCell(image);

            cell.BorderWidth         = 0;
            cell.HorizontalAlignment = Element.ALIGN_CENTER;
            resultTable.AddCell(cell);
            return(resultTable);
        }
Пример #4
0
        // Escribimos el header al inicio de cada página
        public override void OnStartPage(PdfWriter writer, Document document)
        {
            Image headerImage = ImageReport.GetHeader("Header/drawable-hdpi/Header");

            //headerImage.SetAbsolutePosition(-280, 700);
            headerImage.SetAbsolutePosition(-230, 0);

            PdfContentByte cbhead = writer.DirectContent;
            PdfTemplate    tp     = cbhead.CreateTemplate(500, 500);

            tp.AddImage(headerImage);
            cbhead.AddTemplate(tp, -20, 700);

            //base.OnStartPage(writer, document);
            header.WriteSelectedRows(0, -1, 5, 780, writer.DirectContent);
        }
Пример #5
0
        private PdfPCell HeaderBlue(string data, string iconName, float w, float h, float t)
        {
            float[]   widths = new float[] { 10f, 30f };
            PdfPTable table  = new PdfPTable(widths);
            Image     icon   = ImageReport.GetDemographicIcon(iconName);

            icon.ScaleToFit(w, h);
            PdfPCell cell1 = new PdfPCell(icon);

            cell1.HorizontalAlignment = Element.ALIGN_RIGHT;
            cell1.PaddingTop          = t;
            cell1.PaddingRight        = 2f;
            cell1.BorderWidth         = 0;
            table.AddCell(cell1);

            PdfPCell  cell = new PdfPCell();
            Paragraph p    = new Paragraph();
            //p.Alignment = Element.ALIGN_CENTER;



            Font lato = new Font(Font.FontFamily.HELVETICA, 8f, Font.NORMAL, new BaseColor(255, 255, 255));

            lato.Color = new BaseColor(255, 255, 255);

            p.Add(new Chunk(data, lato));
            cell.AddElement(p);
            cell.BorderWidth         = 0;
            cell.HorizontalAlignment = Element.ALIGN_CENTER;
            table.AddCell(cell);

            PdfPCell cellAll = new PdfPCell(table);


            cellAll.Padding         = 10f;
            cellAll.BorderWidth     = 0;
            cellAll.BackgroundColor = new BaseColor(10, 155, 255);

            cellAll.BorderColor = new BaseColor(10, 155, 255);
            return(cellAll);
        }
Пример #6
0
        // Escribimos el header del documento
        public override void OnOpenDocument(PdfWriter writer, Document document)
        {
            base.OnOpenDocument(writer, document);

            float[] widths = new float[] { 400f, 200f };

            header = new PdfPTable(widths);
            header.SpacingAfter = 10F;
            header.TotalWidth   = 600F;

            PdfPCell cell;

            cell                     = new PdfPCell(ImageReport.GetLogo("Logo/drawable-hdpi/Logo"));
            cell.BorderWidth         = 0;
            cell.PaddingRight        = 20f;
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;

            PdfPTable nested = new PdfPTable(1);

            Font latoTitle    = FontFactory.GetFont("Lato", 18f, Font.NORMAL);
            Font latoSubTitle = FontFactory.GetFont("Lato", 12f);

            latoTitle.Color    = BaseColor.WHITE;
            latoSubTitle.Color = BaseColor.WHITE;

            Chunk     text = new Chunk("Reporte comparativo de competencias", latoTitle);
            Paragraph p    = new Paragraph();

            p.Add(text);
            PdfPCell cell1 = new PdfPCell(p);

            cell1.PaddingLeft = 20f;
            cell1.BorderWidth = 0;
            nested.AddCell(cell1);

            latoSubTitle.SetStyle(Font.BOLD);
            //Chunk chunk = new Chunk("Evaluado: ", latoSubTitle);
            //latoSubTitle.SetStyle(Font.NORMAL);
            //Chunk chunk2 = new Chunk(candidateName, latoSubTitle);
            //latoSubTitle.SetStyle(Font.BOLD);
            Chunk chunk3 = new Chunk("Puesto: ", latoSubTitle);

            latoSubTitle.SetStyle(Font.NORMAL);
            Chunk chunk4 = new Chunk(vacantName, latoSubTitle);

            latoSubTitle.SetStyle(Font.BOLD);
            Chunk chunk5 = new Chunk("  |  Fecha de emisión: ", latoSubTitle);

            latoSubTitle.SetStyle(Font.NORMAL);
            expirationDate = expirationDate.AddYears(1);
            Chunk chunk6 = new Chunk(expirationDate.ToString("dd/MM/yyyy"), latoSubTitle);

            p = new Paragraph();
            //p.Add(chunk);
            //p.Add(chunk2);
            p.Add(chunk3);
            p.Add(chunk4);
            p.Add(chunk5);
            p.Add(chunk6);
            cell1             = new PdfPCell(p);
            cell1.BorderWidth = 0;
            cell1.PaddingLeft = 20f;
            cell1.PaddingTop  = 5f;
            nested.AddCell(cell1);
            nested.HorizontalAlignment = Element.ALIGN_CENTER;

            PdfPCell nesthousing = new PdfPCell(nested);

            nesthousing.Padding             = 0f;
            nesthousing.BorderWidth         = 0;
            nesthousing.HorizontalAlignment = Element.ALIGN_CENTER;

            header.AddCell(nesthousing);
            header.AddCell(cell);
        }
Пример #7
0
        private PdfPCell TableContentName(string data, int number)
        {
            float[]   widths = new float[] { 10f, 30f };
            PdfPTable table  = new PdfPTable(widths);

            // Imagen de perfil del candidato
            string urlImageCandidate = this.vacantCandidateReportComparative.candidate[number].candidate.AvatarUri;
            Image  avatar;

            if (!string.IsNullOrWhiteSpace(urlImageCandidate))
            {
                try
                {
                    avatar = ImageReport.GetCandidateImage(urlImageCandidate);
                }
                catch
                {
                    avatar = ImageReport.GetDemographicIcon("Avatar/User");
                }
            }
            else
            {
                avatar = ImageReport.GetDemographicIcon("Avatar/User");
            }

            avatar.ScaleToFit(37f, 37f);
            PdfPCell cell1 = new PdfPCell(avatar);

            cell1.VerticalAlignment = Element.ALIGN_MIDDLE;
            cell1.BorderWidth       = 0;
            cell1.PaddingTop        = 4F;
            cell1.PaddingBottom     = 4F;
            table.AddCell(cell1);

            PdfPCell cell = new PdfPCell();

            cell.PaddingLeft = 10f;
            cell.PaddingTop  = 0.5f;
            Paragraph p     = new Paragraph();
            Font      arial = FontFactory.GetFont("Arial", 12f);

            arial.Color = new BaseColor(0, 0, 0);


            p.Add(new Chunk(data, arial));
            p.Alignment = Element.ALIGN_LEFT;
            cell.AddElement(p);

            Paragraph p2     = new Paragraph(13f);
            Font      arialG = FontFactory.GetFont("Arial", 11f);

            arialG.Color = new BaseColor(10, 155, 255);

            int  unicode   = number + 65;
            char character = (char)unicode;

            p2.Add(new Chunk("Candidato " + character.ToString(), arialG));
            cell.AddElement(p2);
            cell.BorderWidth = 0;

            table.AddCell(cell);
            PdfPCell cellAll = new PdfPCell(table);

            cellAll.BorderWidth = 0;

            return(cellAll);
        }