public virtual void CreatePdf(String dest)
        {
            PdfDocument pdf      = new PdfDocument(new PdfWriter(dest));
            Document    document = new Document(pdf);
            SolidLine   line     = new SolidLine(1f);

            line.SetColor(ColorConstants.RED);
            LineSeparator ls = new LineSeparator(line);

            ls.SetWidth(UnitValue.CreatePercentValue(50));
            ls.SetMarginTop(5);
            IList <IList <String> > resultSet = CsvTo2DList.Convert(SRC, "|");

            resultSet.RemoveAt(0);
            foreach (IList <String> record in resultSet)
            {
                String url   = String.Format("http://www.imdb.com/title/tt{0}", record[0]);
                Link   movie = new Link(record[2], PdfAction.CreateURI(url));
                Div    div   = new Div().SetKeepTogether(true).SetBorderLeft(new SolidBorder(2)).SetPaddingLeft(3).SetMarginBottom
                                   (10).Add(new Paragraph(movie.SetFontSize(14f))).Add(new Paragraph(String.Format("Directed by {0} ({1}, {2})"
                                                                                                                   , record[3], record[4], record[1])));
                FileInfo file = new FileInfo(String.Format("../../../resources/img/{0}.jpg", record[0]));
                if (file.Exists)
                {
                    iText.Layout.Element.Image img = new Image(ImageDataFactory.Create(file.FullName));
                    img.ScaleToFit(10000, 120);
                    div.Add(img);
                }
                div.Add(ls);
                document.Add(div);
            }
            document.Close();
        }
Example #2
0
        public CompositionRelationship(Color lineColor, float lineWidth)
        {
            FilledDiamondCap filledDiamondCap = new FilledDiamondCap();
            SolidLine        solidLine        = new SolidLine();

            cap            = filledDiamondCap;
            lineStyle      = solidLine.lineStyle;
            ObjectPenColor = lineColor;
            ObjectPenWidth = lineWidth;
        }
Example #3
0
        public AssociationRelationship(Color lineColor, float lineWidth)
        {
            ArrowCap  arrowCap  = new ArrowCap();
            SolidLine solidLine = new SolidLine();

            cap            = arrowCap;
            lineStyle      = solidLine.lineStyle;
            ObjectPenColor = lineColor;
            ObjectPenWidth = lineWidth;
        }
Example #4
0
        public AggregationRelationship(Color lineColor, float lineWidth)
        {
            DiamondCap diamondCap = new DiamondCap();
            SolidLine  solidLine  = new SolidLine();

            cap            = diamondCap;
            lineStyle      = solidLine.lineStyle;
            ObjectPenColor = lineColor;
            ObjectPenWidth = lineWidth;
        }
Example #5
0
        public InheritanceRelationship(Color lineColor, float lineWidth)
        {
            FilledArrowCap filledArrowCap = new FilledArrowCap();
            SolidLine      solidLine      = new SolidLine();

            cap            = filledArrowCap;
            lineStyle      = solidLine.lineStyle;
            ObjectPenColor = lineColor;
            ObjectPenWidth = lineWidth;
        }
Example #6
0
        protected void ManipulatePdf(String dest)
        {
            PdfDocument pdfDoc   = new PdfDocument(new PdfWriter(dest));
            PageSize    pageSize = PageSize.A4;
            Document    doc      = new Document(pdfDoc, pageSize);

            PdfCanvas canvas    = new PdfCanvas(pdfDoc.AddNewPage());
            var       re        = new Rectangle(pageSize.GetLeft() + 50, pageSize.GetTop() - 125, 200, 125);
            SolidLine solidLine = new SolidLine();

            solidLine.Draw(canvas, re);
            canvas.Rectangle(re);
            canvas.AddImageFittedIntoRectangle(ImageDataFactory.Create(IMAGE), re, true);

            doc.Close();
        }
Example #7
0
        public virtual void LineSeparatorWidthPercentageTest01()
        {
            String      outFileName = destinationFolder + "lineSeparatorWidthPercentageTest01.pdf";
            String      cmpFileName = sourceFolder + "cmp_lineSeparatorWidthPercentageTest01.pdf";
            PdfDocument pdf         = new PdfDocument(new PdfWriter(outFileName));
            Document    document    = new Document(pdf);
            ILineDrawer line1       = new SolidLine();

            line1.SetColor(ColorConstants.RED);
            ILineDrawer line2 = new SolidLine();

            document.Add(new LineSeparator(line1).SetWidth(50).SetMarginBottom(10));
            document.Add(new LineSeparator(line2).SetWidth(UnitValue.CreatePercentValue(50)));
            document.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
                                                                             , "diff"));
        }
        public static void CreateDoc(string value, Stream destStream)
        {
            var   pdfDoc   = new PdfDocument(new PdfWriter(destStream));
            var   document = new Document(pdfDoc);
            var   pageSize = pdfDoc.GetDefaultPageSize();
            float width    = pageSize.GetWidth() - document.GetLeftMargin() - document.GetRightMargin();

            SolidLine line = new SolidLine();

            AddParagraphWithTabs(document, value, line, width);

            // Draw a custom line to fill both sides, as it is described in iText5 example
            MyLine customLine = new MyLine();

            AddParagraphWithTabs(document, value, customLine, width);

            document.Close();
        }
Example #9
0
        public void ManipulatePdf(String dest)
        {
            PdfDocument pdfDoc   = new PdfDocument(new PdfWriter(dest));
            Document    document = new Document(pdfDoc);
            Rectangle   pageSize = pdfDoc.GetDefaultPageSize();
            float       width    = pageSize.GetWidth() - document.GetLeftMargin() - document.GetRightMargin();

            SolidLine line = new SolidLine();

            AddParagraphWithTabs(document, line, width);

            // Draw a custom line to fill both sides, as it is described in iText5 example
            MyLine customLine = new MyLine();

            AddParagraphWithTabs(document, customLine, width);

            document.Close();
        }
Example #10
0
        public static String crearPDF(string puerta, string orden, List <string> texto,
                                      string paciente, string profesional, string institucion, string fecha, string imgFirma)
        {
            string    archivo = String.Empty;
            SolidLine line    = new SolidLine(1f);

            try
            {
                archivo = ubi_Estudios + puerta + "_" + orden + ".pdf";
                int cantEstudios = texto.Count();
                int cantHojas    = 0;

                //Imagen de encabezado
                ImageData imageData = ImageDataFactory.Create(ubi_Logo);
                Image     image     = new Image(imageData).ScaleToFit(530, 300).
                                      SetHorizontalAlignment(HorizontalAlignment.LEFT);

                //Firma de profesional
                ImageData imageFirma = ImageDataFactory.Create(imgFirma);
                Image     firma      = new Image(imageFirma).ScaleToFit(200, 200).
                                       SetHorizontalAlignment(HorizontalAlignment.RIGHT);

                PdfWriter   writer     = new PdfWriter(archivo);
                PdfDocument pdf        = new PdfDocument(writer);
                Document    document   = new Document(pdf);
                Paragraph   nuevalinea = new Paragraph(" ")
                                         .SetTextAlignment(TextAlignment.CENTER)
                                         .SetFontSize(20);

                //Estilo para etiquetas
                Style   etiqueta = new Style();
                PdfFont font     = PdfFontFactory.CreateFont(FontConstants.HELVETICA_BOLD);
                etiqueta.SetFont(font).SetFontSize(10);

                //Estilo para el dato
                Style   dato  = new Style();
                PdfFont font2 = PdfFontFactory.CreateFont(FontConstants.HELVETICA);
                dato.SetFont(font2).SetFontSize(10);

                //Armo tabla de encabezado de tabla
                //Fila 1

                Paragraph A1 = new Paragraph()
                               .SetTextAlignment(TextAlignment.LEFT);
                A1.Add(new Text("Paciente: ").AddStyle(etiqueta));
                A1.Add(new Text(paciente).AddStyle(dato));

                Cell cellA1 = new Cell();
                cellA1.Add(A1);
                cellA1.SetBorder(Border.NO_BORDER);

                Paragraph B1 = new Paragraph()
                               .SetTextAlignment(TextAlignment.LEFT);
                B1.Add(new Text("Orden: ").AddStyle(etiqueta));
                B1.Add(new Text(puerta + " - " + orden).AddStyle(dato));

                Cell cellB1 = new Cell();
                cellB1.Add(B1);
                cellB1.SetBorder(Border.NO_BORDER);


                //Fila 2
                Paragraph A2 = new Paragraph()
                               .SetTextAlignment(TextAlignment.LEFT);
                A2.Add(new Text("Solicitó Dr/a.: ").AddStyle(etiqueta));
                A2.Add(new Text(profesional).AddStyle(dato));

                Cell cellA2 = new Cell();
                cellA2.Add(A2);
                cellA2.SetBorder(Border.NO_BORDER);

                Paragraph B2 = new Paragraph()
                               .SetTextAlignment(TextAlignment.LEFT);
                B2.Add(new Text("Fecha: ").AddStyle(etiqueta));
                B2.Add(new Text(fecha).AddStyle(dato));

                Cell cellB2 = new Cell();
                cellB2.Add(B2);
                cellB2.SetBorder(Border.NO_BORDER);


                //Fila 3
                Paragraph A3 = new Paragraph()
                               .SetTextAlignment(TextAlignment.LEFT);
                A3.Add(new Text("Institucion: ").AddStyle(etiqueta));
                A3.Add(new Text(institucion).AddStyle(dato));

                Cell cellA3 = new Cell();
                cellA3.Add(A3);
                cellA3.SetBorder(Border.NO_BORDER);

                foreach (string t in texto)
                {
                    cantHojas++;

                    //Agrego imagen de encabezado
                    document.Add(image);

                    //Separadores
                    document.Add(nuevalinea);
                    document.Add(nuevalinea);

                    //Armo y configuro tabla
                    float[] separacion = new float[] { 380f, 40f };
                    Table   tabla      = new Table(separacion);
                    tabla.SetFontSize(10);
                    tabla.SetHorizontalAlignment(HorizontalAlignment.LEFT);

                    //Numero de hoja
                    Paragraph B3 = new Paragraph()
                                   .SetTextAlignment(TextAlignment.LEFT);
                    B3.Add(new Text("Hoja: ").AddStyle(etiqueta));
                    B3.Add(new Text(cEnvios.completarCeros(cantHojas.ToString(), 4)).AddStyle(dato));

                    Cell cellB3 = new Cell();
                    cellB3.Add(B3);
                    cellB3.SetBorder(Border.NO_BORDER);

                    //Agrego celdas
                    tabla.AddCell(cellA1);
                    tabla.AddCell(cellB1);
                    tabla.AddCell(cellA2);
                    tabla.AddCell(cellB2);
                    tabla.AddCell(cellA3);
                    tabla.AddCell(cellB3);

                    //Agrego la tabla
                    document.Add(tabla);

                    //Separadores
                    document.Add(nuevalinea);
                    document.Add(nuevalinea);

                    Paragraph txt = new Paragraph(t)
                                    .SetTextAlignment(TextAlignment.LEFT)
                                    .SetFontSize(10);

                    //Agrego texto del estudio
                    document.Add(txt);

                    //Separador
                    document.Add(nuevalinea);

                    //Imagen de firma
                    document.Add(firma);

                    if (cantHojas < cantEstudios)
                    {
                        //Nueva pagina
                        document.Add(new AreaBreak(AreaBreakType.NEXT_PAGE));
                    }
                }

                //Cierro el documento
                document.Close();
            }
            catch (Exception ex)
            {
                cLog.log.Error("cPDF (crearPDF): " + ex.ToString() + " * " + archivo);
                cLog.log.Error(String.Format("cPDF (crearPDF): Puerta: {0}, Orden: {1}, Estudios: {2}, " +
                                             "Paciente: {3}, Profesional: {4}, Institucion: {5}, Fecha: {6}, Firma: {7}.", puerta, orden,
                                             texto.Count.ToString(), paciente, profesional, institucion, fecha, imgFirma));
            }

            return(archivo);
        }
Example #11
0
        private void ManipulatePdf(String dest)
        {
            PdfDocument pdfDoc = new PdfDocument(new PdfWriter(dest));
            Document    doc    = new Document(pdfDoc, new PageSize(595, 842));

            doc.SetMargins(55, 15, 35, 15);

            ILineDrawer line = new SolidLine(2);

            line.SetColor(ColorConstants.LIGHT_GRAY);

            LineSeparator tableEndSeparator = new LineSeparator(line);

            tableEndSeparator.SetMarginTop(10);

            String[] header  = { "Header1", "Header2", "Header3", "Header4", "Header5" };
            String[] content = { "column 1", "column 2", "some Text in column 3", "Test data ", "column 5" };

            Table table = new Table(
                UnitValue.CreatePercentArray(new float[] { 3, 2, 4, 3, 2 })).UseAllAvailableWidth();

            foreach (String columnHeader in header)
            {
                Paragraph headerParagraph = new Paragraph(columnHeader)
                                            .SetFont(PdfFontFactory.CreateFont(StandardFonts.HELVETICA_BOLD))
                                            .SetFontSize(10);

                Cell headerCell = new Cell()
                                  .Add(headerParagraph)
                                  .SetTextAlignment(TextAlignment.CENTER)
                                  .SetVerticalAlignment(VerticalAlignment.MIDDLE)
                                  .SetBorder(new SolidBorder(ColorConstants.LIGHT_GRAY, 1))
                                  .SetPadding(8);

                table.AddHeaderCell(headerCell);
            }

            for (int i = 0; i < 15; i++)
            {
                int j = 0;

                foreach (String text in content)
                {
                    Paragraph paragraph = new Paragraph((i == 13 && j == 3) ? "Test data \n Test data \n Test data" : text)
                                          .SetFont(PdfFontFactory.CreateFont(StandardFonts.HELVETICA))
                                          .SetFontSize(10);

                    Cell cell = new Cell()
                                .Add(paragraph)
                                .SetBorder(new SolidBorder(ColorConstants.LIGHT_GRAY, 1))
                                .SetPaddingLeft(5)
                                .SetPaddingTop(5)
                                .SetPaddingRight(5)
                                .SetPaddingBottom(5);

                    table.AddCell(cell);

                    j++;
                }
            }

            doc.Add(table);
            doc.Add(tableEndSeparator);

            for (int k = 0; k < 5; k++)
            {
                Paragraph info = new Paragraph("Some title")
                                 .SetFont(PdfFontFactory.CreateFont(StandardFonts.HELVETICA))
                                 .SetFontSize(10)
                                 .SetMarginTop(12);

                doc.Add(info);

                table = new Table(
                    UnitValue.CreatePercentArray(new float[] { 3, 2, 4, 3, 2 })).UseAllAvailableWidth();
                table.SetMarginTop(15);

                foreach (String columnHeader in header)
                {
                    Paragraph paragraph = new Paragraph(columnHeader)
                                          .SetFont(PdfFontFactory.CreateFont(StandardFonts.HELVETICA_BOLD))
                                          .SetFontSize(10);

                    Cell headerCell = new Cell()
                                      .Add(paragraph)
                                      .SetTextAlignment(TextAlignment.CENTER)
                                      .SetVerticalAlignment(VerticalAlignment.MIDDLE)
                                      .SetBorder(new SolidBorder(ColorConstants.LIGHT_GRAY, 1))
                                      .SetPaddingLeft(8)
                                      .SetPaddingTop(8)
                                      .SetPaddingRight(8)
                                      .SetPaddingBottom(8);

                    table.AddHeaderCell(headerCell);
                }

                foreach (String text in content)
                {
                    Paragraph paragraph = new Paragraph(text)
                                          .SetFont(PdfFontFactory.CreateFont(StandardFonts.HELVETICA))
                                          .SetFontSize(10);

                    Cell cell = new Cell()
                                .Add(paragraph)
                                .SetBorder(new SolidBorder(ColorConstants.LIGHT_GRAY, 1))
                                .SetPaddingLeft(5)
                                .SetPaddingTop(5)
                                .SetPaddingRight(5)
                                .SetPaddingBottom(5);

                    table.AddCell(cell);
                }

                doc.Add(table);
                doc.Add(tableEndSeparator);
            }

            doc.Close();
        }
Example #12
0
        public virtual void CreatePdf(String dest)
        {
            //document formalities
            var writer   = new PdfWriter(dest);
            var pdf      = new PdfDocument(writer);
            var document = new Document(pdf, PageSize.A4);

            document.SetMargins(80, 80, 80, 80);

            //fonts
            var timesroman  = PdfFontFactory.CreateFont(StandardFonts.TIMES_ROMAN);
            var timesitalic = PdfFontFactory.CreateFont(StandardFonts.TIMES_ITALIC);
            var helvatica   = PdfFontFactory.CreateFont(StandardFonts.HELVETICA);
            var bold        = PdfFontFactory.CreateFont(StandardFonts.HELVETICA_BOLD);
            var italic      = PdfFontFactory.CreateFont(StandardFonts.HELVETICA_OBLIQUE);

            //photo import
            var photo = new Image(ImageDataFactory.Create(PHOTO));

            photo.SetHeight(90);
            photo.SetFixedPosition(450, 650);

            //writing to file
            string[] writerline = new string[2];
            using (var filewriter = new StreamWriter("D:/saved.txt"))
            {
                // identities
                for (int i = 0; i < 4; i++)
                {
                    switch (i)
                    {
                    case 0: Console.Write("Identities:\n    name + surname: "); break;

                    case 1: Console.Write("    birthdate: "); break;

                    case 2: Console.Write("    phone:"); break;

                    case 3: Console.Write("    e-mail:"); break;
                    }
                    filewriter.WriteLine(Console.ReadLine());
                }

                //tables content
                ConsoleKeyInfo cki = new ConsoleKeyInfo((char)ConsoleKey.RightArrow, ConsoleKey.RightArrow, false, false, false);
                for (int j = 0; j < 4; j++)
                {
                    //work
                    string category = "workplace";
                    string first    = "proffesion";
                    string second   = "work dates";
                    string third    = "company name";
                    int    counter  = 1;
                    int    noinfo   = 3;

                    if (j == 1) //school
                    {
                        category = "school";
                        first    = "school name";
                        second   = "school dates";
                        third    = "degree";
                    }
                    else if (j == 2) //language
                    {
                        category = "language";
                        first    = "language";
                        second   = "advancement level";
                        noinfo   = 2;
                    }
                    else if (j == 3) //interests
                    {
                        category = "interests";
                        first    = "interest";
                        noinfo   = 1;
                    }
                    // checks whether user wants to add data
                    cki = ValidateCki(cki, category, counter);

                    //if yes then
                    if (cki.Key.ToString() == "Y")
                    {
                        //ask user for data from this iteration
                        counter = WriteData(category, first, second, third, j, counter, filewriter);
                        cki     = ValidateCki(cki, category, counter);

                        if (cki.Key.ToString() == "Y")
                        {
                            counter = WriteData(category, first, second, third, j, counter, filewriter);
                            cki     = ValidateCki(cki, category, counter);

                            if (cki.Key.ToString() == "Y")
                            {
                                counter = WriteData(category, first, second, third, j, counter, filewriter);
                            }
                            //when user decide not to add data then write in this file line "no data".
                            else
                            {
                                for (int i = 0; i < noinfo; i++)
                                {
                                    filewriter.WriteLine("no data");
                                }
                            }
                        }
                        else
                        {
                            for (int i = 0; i < 2 * noinfo; i++)
                            {
                                filewriter.WriteLine("no data");
                            }
                        }
                    }
                    else
                    {
                        for (int i = 0; i < 3 * noinfo; i++)
                        {
                            filewriter.WriteLine("no data");
                        }
                    }
                }
            }
            //backup of user data is stored in this file.

            //reading from the file
            string[] line = new string[31];
            using (var reader = new StreamReader("D:/saved.txt"))
            {
                for (int i = 0; i < line.Length; i++)
                {
                    line[i] = reader.ReadLine();
                }
            }

            //name all lines with related name for further usage

            //personal data
            string[] personal = new string[4];
            personal[0] = line[0];
            personal[1] = line[1];
            personal[2] = line[2];
            personal[3] = line[3];

            //workplace
            string[] workname = new string[3];
            workname[0] = line[4];
            workname[1] = line[7];
            workname[2] = line[10];
            string[] workdate = new string[3];
            workdate[0] = line[5];
            workdate[1] = line[8];
            workdate[2] = line[11];
            string[] workplace = new string[3];
            workplace[0] = line[6];
            workplace[1] = line[9];
            workplace[2] = line[12];

            //education
            string[] schoolname = new string[3];
            schoolname[0] = line[13];
            schoolname[1] = line[16];
            schoolname[2] = line[19];
            string[] schooldate = new string[3];
            schooldate[0] = line[14];
            schooldate[1] = line[17];
            schooldate[2] = line[20];
            string[] schoolplace = new string[3];
            schoolplace[0] = line[15];
            schoolplace[1] = line[18];
            schoolplace[2] = line[21];

            //language
            string[] languagename = new string[3];
            languagename[0] = line[22];
            languagename[1] = line[24];
            languagename[2] = line[26];
            string[] languagelevel = new string[3];
            languagelevel[0] = line[23];
            languagelevel[1] = line[25];
            languagelevel[2] = line[27];

            //interests
            string[] interestname = new string[3];
            interestname[0] = line[28];
            interestname[1] = line[29];
            interestname[2] = line[30];

            //Decalre separators
            SolidLine     solidline = new SolidLine(2f);
            LineSeparator separator = new LineSeparator(solidline);

            separator.SetMarginTop(10);
            separator.SetMarginBottom(10);

            //headline ( CV + name)
            document.Add(new Paragraph(line[0]).SetFont(timesroman).SetFontSize(20));
            document.Add(new Paragraph("Cirraculum Vitae").SetFontSize(9).SetFont(italic));

            //identities
            var person = new Table(new float[] { 1, 2 });

            Cell[] details      = new Cell[3];
            Cell[] details_data = new Cell[3];

            for (int i = 0; i < 3; i++)
            {
                switch (i)
                {
                case 0: details[i] = new Cell().Add(new Paragraph("Birth date:")); break;

                case 1: details[i] = new Cell().Add(new Paragraph("Phone")); break;

                case 2: details[i] = new Cell().Add(new Paragraph("E-mail:")); break;
                }
                details[i].SetFont(bold).SetFontSize(10).SetBorder(Border.NO_BORDER).SetWidth(100);
                details_data[i] = new Cell().Add(new Paragraph(personal[i + 1])).SetFontSize(10).SetBorder(Border.NO_BORDER);
                person.AddCell(details[i]);
                person.AddCell(details_data[i]);
            }

            // Other table cells and paragraphs

            Paragraph[] pworkname  = new Paragraph[3];
            Paragraph[] pworkplace = new Paragraph[3];
            Cell[]      work       = new Cell[3];
            Cell[]      work_dates = new Cell[3];

            Paragraph[] pschoolname  = new Paragraph[3];
            Paragraph[] pschoolplace = new Paragraph[3];
            Cell[]      school       = new Cell[3];
            Cell[]      school_dates = new Cell[3];

            Paragraph[] planguagename  = new Paragraph[3];
            Paragraph[] planguagelevel = new Paragraph[3];
            Cell[]      language       = new Cell[3];

            var pinterest = new Paragraph();

            //table structures
            var experience = new Table(new float[] { 2, 5, 2 });
            var education  = new Table(new float[] { 2, 5, 2 });
            var languages  = new Table(new float[] { 2, 5, 2 });
            var interests  = new Table(new float[] { 2, 5, 2 });

            // left side cell (with title or empty)
            Cell[] work_empty           = new Cell[2];
            Cell[] school_empty         = new Cell[2];
            Cell[] language_empty_left  = new Cell[2];
            Cell[] language_empty_right = new Cell[2];
            Cell[] interest_empty_left  = new Cell[2];
            Cell[] interest_empty_right = new Cell[2];
            Cell[] title = new Cell[4];

            for (int i = 0; i < 2; i++)
            {
                work_empty[i]   = new Cell().Add(new Paragraph("")).SetBorder(Border.NO_BORDER).SetWidth(100);
                school_empty[i] = new Cell().Add(new Paragraph("")).SetBorder(Border.NO_BORDER).SetWidth(100);

                language_empty_left[i]  = new Cell().Add(new Paragraph("")).SetBorder(Border.NO_BORDER).SetWidth(100);
                language_empty_right[i] = new Cell().Add(new Paragraph("")).SetBorder(Border.NO_BORDER).SetWidth(100);

                interest_empty_left[i]  = new Cell().Add(new Paragraph("")).SetBorder(Border.NO_BORDER).SetWidth(100);
                interest_empty_right[i] = new Cell().Add(new Paragraph("")).SetBorder(Border.NO_BORDER).SetWidth(100);
            }

            for (int i = 0; i < 4; i++)
            {
                switch (i)
                {
                case 0: title[i] = new Cell().Add(new Paragraph("Experience:")); break;

                case 1: title[i] = new Cell().Add(new Paragraph("Education")); break;

                case 2: title[i] = new Cell().Add(new Paragraph("Languages:")); break;

                case 3: title[i] = new Cell().Add(new Paragraph("Interests:")); break;
                }
                title[i].SetFont(timesroman).SetFontSize(15).SetBorder(Border.NO_BORDER).SetWidth(100);
            }

            //table constructor
            for (int i = 0; i < 3; i++)
            {
                //work
                pworkname[i]  = new Paragraph(workname[i]);
                work_dates[i] = new Cell().Add(new Paragraph(workdate[i]));
                pworkplace[i] = new Paragraph(workplace[i]);

                pworkname[i].SetFontSize(13).SetFont(timesroman);
                pworkplace[i].SetFontSize(10).SetFont(timesitalic).SetFontColor(DeviceRgb.BLUE);

                work[i] = new Cell().Add(pworkname[i]).Add(pworkplace[i]).SetWidth(230).SetBorder(Border.NO_BORDER);
                work_dates[i].SetFont(timesroman).SetFontSize(11).SetTextAlignment(iText.Layout.Properties.TextAlignment.RIGHT).SetWidth(120).SetBorder(Border.NO_BORDER);

                //school
                pschoolname[i]  = new Paragraph(schoolname[i]);
                school_dates[i] = new Cell().Add(new Paragraph(schooldate[i]));
                pschoolplace[i] = new Paragraph(schoolplace[i]);

                pschoolname[i].SetFontSize(13).SetFont(timesroman);
                pschoolplace[i].SetFontSize(10).SetFont(timesitalic).SetFontColor(DeviceRgb.BLUE);

                school[i] = new Cell().Add(pschoolname[i]).Add(pschoolplace[i]).SetWidth(230).SetBorder(Border.NO_BORDER);
                school_dates[i].SetFont(timesroman).SetFontSize(11).SetTextAlignment(iText.Layout.Properties.TextAlignment.RIGHT).SetWidth(120).SetBorder(Border.NO_BORDER);

                //language cells
                planguagename[i] = new Paragraph(languagename[i] + " - " + languagelevel[i]);
                language[i]      = new Cell().Add(planguagename[i]).SetWidth(230).SetFontSize(10).SetHeight(20).SetBorder(Border.NO_BORDER);

                //adding data to tables.
                if (workplace[i] != "no data")
                {
                    if (i == 0)
                    {
                        experience.AddCell(title[0]);
                    }
                    else
                    {
                        experience.AddCell(work_empty[i - 1]);
                    }
                    experience.AddCell(work[i]);
                    experience.AddCell(work_dates[i]);
                }
                if (schoolplace[i] != "no data")
                {
                    if (i == 0)
                    {
                        education.AddCell(title[1]);
                    }
                    else
                    {
                        education.AddCell(school_empty[i - 1]);
                    }
                    education.AddCell(school[i]);
                    education.AddCell(school_dates[i]);
                }
                if (languagename[i] != "no data")
                {
                    if (i == 0)
                    {
                        languages.AddCell(title[2]);
                        languages.AddCell(language[0]);
                        languages.AddCell(language_empty_right[0]);
                    }
                    else
                    {
                        languages.AddCell(language_empty_left[i - 1]);
                        languages.AddCell(language[i]);
                        languages.AddCell(language_empty_right[i - 1]);
                    }
                }
                if (interestname[i] != "no data")
                {
                    if (i == 0)
                    {
                        pinterest.Add(interestname[i]);
                    }
                    else
                    {
                        pinterest.Add(", " + interestname[i]);
                    }
                }
            }

            var cinterest = new Cell().SetWidth(230).SetFontSize(10).SetHeight(20).SetBorder(Border.NO_BORDER);

            cinterest.Add(pinterest);

            interests.AddCell(title[3]);
            interests.AddCell(cinterest);
            interests.AddCell(interest_empty_right[0]);

            document.Add(person);
            document.Add(new Paragraph("\n"));
            document.Add(separator);
            document.Add(experience);
            if (!experience.IsEmpty())
            {
                document.Add(separator);
            }
            document.Add(education);
            if (!education.IsEmpty())
            {
                document.Add(separator);
            }
            document.Add(languages);
            if (!languages.IsEmpty())
            {
                document.Add(separator);
            }
            document.Add(interests);
            if (!interests.IsEmpty())
            {
                document.Add(separator);
            }

            document.Add(photo);
            document.Close();
        }