Beispiel #1
0
 public abstract void Design(Person person, Education sch, Education col, Education uni, WorkHistory work, AdditionalCourse adc);
        public override void Design(Person person, Education sch, Education col, Education uni, WorkHistory work, AdditionalCourse adc)
        {
            // creating the pdf
            Document doc1 = new Document(PageSize.A3);

            PdfWriter.GetInstance(doc1, new FileStream(path + ".pdf", FileMode.Create));
            //working on the pdf
            doc1.Open();
            PdfPTable table1  = new PdfPTable(1);
            PdfPTable table2  = new PdfPTable(1);
            PdfPTable table3  = new PdfPTable(1);
            PdfPTable table4  = new PdfPTable(1);
            PdfPTable table5  = new PdfPTable(1);
            PdfPTable table6  = new PdfPTable(1);
            PdfPTable table7  = new PdfPTable(1);
            PdfPTable table8  = new PdfPTable(1);
            PdfPTable table9  = new PdfPTable(1);
            PdfPTable table10 = new PdfPTable(1);
            PdfPTable table11 = new PdfPTable(1);
            PdfPTable table12 = new PdfPTable(1);
            PdfPTable table13 = new PdfPTable(1);
            PdfPTable table14 = new PdfPTable(1);
            PdfPTable table15 = new PdfPTable(1);
            PdfPTable table16 = new PdfPTable(1);
            PdfPTable table17 = new PdfPTable(1);
            PdfPTable table18 = new PdfPTable(1);
            PdfPTable table19 = new PdfPTable(1);
            PdfPTable table20 = new PdfPTable(1);
            PdfPTable table21 = new PdfPTable(1);

            table1.WidthPercentage = 80;
            table1.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
            table1.DefaultCell.VerticalAlignment   = Element.ALIGN_CENTER;
            table1.DefaultCell.BorderWidth         = 0;
            table2.WidthPercentage = 80;
            table2.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
            table2.DefaultCell.VerticalAlignment   = Element.ALIGN_CENTER;
            table2.DefaultCell.BorderWidth         = 0;
            table2.DefaultCell.PaddingTop          = 10;
            table3.WidthPercentage = 80;
            table3.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
            table3.DefaultCell.VerticalAlignment   = Element.ALIGN_LEFT;
            table3.DefaultCell.BorderWidth         = 0;
            table3.DefaultCell.PaddingTop          = 100;
            table4.WidthPercentage = 80;
            table4.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
            table4.DefaultCell.VerticalAlignment   = Element.ALIGN_LEFT;
            table4.DefaultCell.BorderWidth         = 0;
            table4.DefaultCell.PaddingTop          = 10;
            table4.WidthPercentage = 80;
            table5.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
            table5.DefaultCell.VerticalAlignment   = Element.ALIGN_LEFT;
            table5.DefaultCell.BorderWidth         = 0;
            table5.DefaultCell.PaddingTop          = 20;
            table6.DefaultCell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table6.DefaultCell.VerticalAlignment   = Element.ALIGN_RIGHT;
            table6.DefaultCell.BorderWidth         = 0;
            table6.DefaultCell.PaddingTop          = -20;
            table7.DefaultCell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table7.DefaultCell.VerticalAlignment   = Element.ALIGN_RIGHT;
            table7.DefaultCell.BorderWidth         = 0;
            table8.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
            table8.DefaultCell.VerticalAlignment   = Element.ALIGN_LEFT;
            table8.DefaultCell.BorderWidth         = 0;
            table8.DefaultCell.PaddingTop          = 5;
            table9.DefaultCell.BorderWidth         = 0;
            table9.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
            table9.DefaultCell.VerticalAlignment   = Element.ALIGN_LEFT;
            table9.WidthPercentage                  = 80;
            table10.DefaultCell.BorderWidth         = 0;
            table10.DefaultCell.VerticalAlignment   = Element.ALIGN_LEFT;
            table10.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
            table10.DefaultCell.PaddingTop          = -15;
            table10.DefaultCell.PaddingLeft         = 30;
            table11.DefaultCell.BorderWidth         = 0;
            table11.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
            table11.DefaultCell.VerticalAlignment   = Element.ALIGN_LEFT;
            table11.DefaultCell.PaddingTop          = 20;
            table12.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
            table12.DefaultCell.VerticalAlignment   = Element.ALIGN_LEFT;
            table12.DefaultCell.BorderWidth         = 0;
            table12.DefaultCell.PaddingTop          = 20;
            table13.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
            table13.DefaultCell.VerticalAlignment   = Element.ALIGN_LEFT;
            table13.DefaultCell.BorderWidth         = 0;
            table13.DefaultCell.PaddingTop          = 10;
            table14.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
            table14.DefaultCell.VerticalAlignment   = Element.ALIGN_LEFT;
            table14.DefaultCell.BorderWidth         = 0;
            table14.DefaultCell.PaddingTop          = 20;
            table15.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
            table15.DefaultCell.VerticalAlignment   = Element.ALIGN_LEFT;
            table15.DefaultCell.BorderWidth         = 0;
            table15.DefaultCell.PaddingTop          = 10;
            table16.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
            table16.DefaultCell.VerticalAlignment   = Element.ALIGN_LEFT;
            table16.DefaultCell.BorderWidth         = 0;
            table16.DefaultCell.PaddingTop          = 20;
            table17.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
            table17.DefaultCell.VerticalAlignment   = Element.ALIGN_LEFT;
            table17.DefaultCell.BorderWidth         = 0;
            table17.DefaultCell.PaddingTop          = 10;
            table18.DefaultCell.BorderWidth         = 0;
            table18.DefaultCell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table18.DefaultCell.VerticalAlignment   = Element.ALIGN_RIGHT;
            table18.DefaultCell.PaddingTop          = -250;
            table19.DefaultCell.BorderWidth         = 0;
            table19.DefaultCell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table19.DefaultCell.VerticalAlignment   = Element.ALIGN_RIGHT;
            table19.DefaultCell.PaddingTop          = -230;
            table21.DefaultCell.BorderWidth         = 0;
            table21.DefaultCell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table21.DefaultCell.VerticalAlignment   = Element.ALIGN_RIGHT;
            table20.DefaultCell.PaddingTop          = 6;
            table20.DefaultCell.BorderWidth         = 0;
            table20.DefaultCell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table20.DefaultCell.VerticalAlignment   = Element.ALIGN_RIGHT;
            table20.DefaultCell.PaddingTop          = -17;
            Chunk c1 = new Chunk(person.name, FontFactory.GetFont("Sitka Small"));

            c1.Font.Color = new BaseColor(0, 0, 0);
            c1.Font.SetStyle(0);
            c1.Font.Size = 25;
            Phrase p1 = new Phrase();

            p1.Add(c1);
            table1.AddCell(p1);
            Chunk c2 = new Chunk(person.address, FontFactory.GetFont("Sitka Display"));

            c2.Font.Color = new BaseColor(0, 0, 0);
            c2.Font.SetStyle(0);
            c2.Font.Size = 14;
            Phrase p2 = new Phrase();

            p2.Add(c2);
            table2.AddCell(p2);
            Chunk c3 = new Chunk(person.contactNum, FontFactory.GetFont("Sitka Display"));

            //Console.WriteLine();
            c3.Font.Color = new BaseColor(0, 0, 0);
            c3.Font.SetStyle(1);
            c3.Font.Size = 13;
            Phrase p3 = new Phrase();

            p3.Add(c3);
            table2.AddCell(p3);

            Chunk c4 = new Chunk(person.email, FontFactory.GetFont("Sitka Display"));

            c4.Font.Color = new BaseColor(0, 0, 0);
            c4.Font.SetStyle(2);
            c4.Font.Size = 13;
            //Console.WriteLine();
            Phrase p4 = new Phrase();

            p4.Add(c4);
            table2.AddCell(p4);

            Chunk c5 = new Chunk("Objective", FontFactory.GetFont("Stika Text"));

            c5.Font.Color = new BaseColor(0, 0, 0);
            c5.Font.SetStyle(1);
            c5.Font.Size = 18;
            Phrase p5 = new Phrase();

            p5.Add(c5);
            table3.AddCell(p5);
            Chunk c6 = new Chunk(person.objective, FontFactory.GetFont("Stika Text"));

            c6.Font.Color = new BaseColor(0, 0, 0);
            c6.Font.SetStyle(0);
            c6.Font.Size = 14;
            Phrase p6 = new Phrase();

            p6.Add(c6);
            table4.AddCell(p6);

            Chunk c7 = new Chunk("Education", FontFactory.GetFont("Stika Text"));

            c7.Font.Color = new BaseColor(0, 0, 0);
            c7.Font.SetStyle(1);
            c7.Font.Size = 18;
            Phrase p7 = new Phrase();

            p7.Add(c7);
            table5.AddCell(p7);
            Chunk c8 = new Chunk(person.city, FontFactory.GetFont("Stika Display"));

            c8.Font.Color = new BaseColor(0, 0, 0);
            c8.Font.SetStyle(0);
            c8.Font.Size = 14;
            Phrase p8 = new Phrase();

            p8.Add(c8);
            table6.AddCell(p8);
            Chunk c9 = new Chunk(uni.startedFrom + " " + uni.endedOn, FontFactory.GetFont("Stika Display"));

            c9.Font.Color = new BaseColor(0, 0, 0);
            c9.Font.SetStyle(0);
            c9.Font.Size = 14;
            Phrase p9 = new Phrase();

            p9.Add(c9);
            table7.AddCell(p9);
            Chunk c10 = new Chunk(uni.instituteName, FontFactory.GetFont("Stika Text"));

            c10.Font.SetStyle(1);
            c10.Font.Size = 16;
            Phrase p10 = new Phrase();

            p10.Add(c10);
            table8.AddCell(p10);
            Chunk c11 = new Chunk(uni.qualification, FontFactory.GetFont("Stika Text"));

            c11.Font.SetStyle(0);
            c11.Font.Size = 13;
            Phrase p11 = new Phrase();

            p11.Add(c11);
            table9.AddCell(p11);
            Chunk c12 = new Chunk("");

            c12.Font.SetStyle(0);
            c12.Font.Size = 13;
            Phrase p12 = new Phrase();

            p12.Add(c12);
            table10.AddCell(p12);
            Chunk c13 = new Chunk(col.instituteName, FontFactory.GetFont("Stika Small"));

            c13.Font.Color = new BaseColor(0, 0, 0);
            c13.Font.SetStyle(1);
            c13.Font.Size = 16;
            Phrase p13 = new Phrase();

            p13.Add(c13);
            table11.AddCell(p13);
            Chunk c14 = new Chunk(col.qualification, FontFactory.GetFont("Stika Small"));

            c14.Font.Color = new BaseColor(0, 0, 0);
            c14.Font.SetStyle(0);
            c14.Font.Size = 13;
            Phrase p14 = new Phrase();

            p14.Add(c14);
            table11.AddCell(p14);
            Chunk c15 = new Chunk(sch.instituteName, FontFactory.GetFont("Stika Text"));

            c15.Font.Color = new BaseColor(0, 0, 0);
            c15.Font.SetStyle(1);
            c15.Font.Size = 18;
            Phrase p15 = new Phrase();

            p15.Add(c15);
            table12.AddCell(p15);
            Chunk c16 = new Chunk(sch.qualification, FontFactory.GetFont("Stika Small"));

            c16.Font.Color = new BaseColor(0, 0, 0);
            c16.Font.SetStyle(0);
            c16.Font.Size = 13;
            Phrase p16 = new Phrase();

            p16.Add(c16);
            table13.AddCell(p16);
            Chunk c17 = new Chunk(" ", FontFactory.GetFont("Stika Small"));

            c17.Font.Color = new BaseColor(0, 0, 0);
            c17.Font.SetStyle(0);
            c17.Font.Size = 13;
            Phrase p17 = new Phrase();

            p17.Add(c17);
            table13.AddCell(p17);
            Chunk c18 = new Chunk(" ", FontFactory.GetFont("Stika Small"));

            c18.Font.Color = new BaseColor(0, 0, 0);
            c18.Font.SetStyle(0);
            c18.Font.Size = 13;
            Phrase p18 = new Phrase();

            p18.Add(c18);
            table13.AddCell(p18);
            Chunk c19 = new Chunk(" ", FontFactory.GetFont("Stika Small"));

            c19.Font.Color = new BaseColor(0, 0, 0);
            c19.Font.SetStyle(0);
            c19.Font.Size = 13;
            Phrase p19 = new Phrase();

            p19.Add(c19);
            table13.AddCell(p19);
            Chunk c20 = new Chunk(" ", FontFactory.GetFont("Stika Small"));

            c20.Font.Color = new BaseColor(0, 0, 0);
            c20.Font.SetStyle(0);
            c20.Font.Size = 13;
            Phrase p20 = new Phrase();

            p20.Add(c20);
            table13.AddCell(p20);
            Chunk c21 = new Chunk(" ", FontFactory.GetFont("Stika Small"));

            c21.Font.Color = new BaseColor(0, 0, 0);
            c21.Font.SetStyle(0);
            c21.Font.Size = 13;
            Phrase p21 = new Phrase();

            p21.Add(c21);
            table13.AddCell(p21);
            Chunk c22 = new Chunk(" ", FontFactory.GetFont("Stika Small"));

            c22.Font.Color = new BaseColor(0, 0, 0);
            c22.Font.SetStyle(0);
            c22.Font.Size = 13;
            Phrase p22 = new Phrase();

            p22.Add(c22);
            table13.AddCell(p22);
            Chunk c23 = new Chunk("Work Experience:", FontFactory.GetFont("Stika Text"));

            c23.Font.Color = new BaseColor(0, 0, 0);
            c23.Font.SetStyle(1);
            c23.Font.Size = 18;
            Phrase p23 = new Phrase();

            p23.Add(c23);
            table14.AddCell(p23);
            Chunk c24 = new Chunk(work.employer, FontFactory.GetFont("Stika Small"));

            c24.Font.Color = new BaseColor(0, 0, 0);
            c24.Font.SetStyle(0);
            c24.Font.Size = 13;
            Phrase p24 = new Phrase();

            p24.Add(c24);
            table15.AddCell(p24);
            Chunk c25 = new Chunk(work.position, FontFactory.GetFont("Stika Small"));

            c25.Font.Color = new BaseColor(0, 0, 0);
            c25.Font.SetStyle(0);
            c25.Font.Size = 13;
            Phrase p25 = new Phrase();

            p25.Add(c25);
            table15.AddCell(p25);
            Chunk c26 = new Chunk(" ", FontFactory.GetFont("Stika Small"));

            c26.Font.Color = new BaseColor(0, 0, 0);
            c26.Font.SetStyle(0);
            c26.Font.Size = 13;
            Phrase p26 = new Phrase();

            p26.Add(c26);
            table15.AddCell(p26);
            Chunk c27 = new Chunk(" ", FontFactory.GetFont("Stika Small"));

            c27.Font.Color = new BaseColor(0, 0, 0);
            c27.Font.SetStyle(0);
            c27.Font.Size = 13;
            Phrase p27 = new Phrase();

            p27.Add(c27);
            table15.AddCell(p27);
            Chunk c28 = new Chunk("Skills:", FontFactory.GetFont("Stika Text"));

            c28.Font.Color = new BaseColor(0, 0, 0);
            c28.Font.SetStyle(1);
            c28.Font.Size = 18;
            Phrase p28 = new Phrase();

            p28.Add(c28);
            table16.AddCell(p28);
            Chunk c29 = new Chunk(adc.courseName, FontFactory.GetFont("Stika Small"));

            c29.Font.Color = new BaseColor(0, 0, 0);
            c29.Font.SetStyle(0);
            c29.Font.Size = 13;
            Phrase p29 = new Phrase();

            p29.Add(c29);
            table17.AddCell(p29);
            Chunk c30 = new Chunk(adc.courseFrom, FontFactory.GetFont("Stika Small"));

            c30.Font.Color = new BaseColor(0, 0, 0);
            c30.Font.SetStyle(0);
            c30.Font.Size = 13;
            Phrase p30 = new Phrase();

            p30.Add(c30);
            table17.AddCell(p30);
            Chunk c31 = new Chunk(" ", FontFactory.GetFont("Stika Small"));

            c31.Font.Color = new BaseColor(0, 0, 0);
            c31.Font.SetStyle(0);
            c31.Font.Size = 13;
            Phrase p31 = new Phrase();

            p31.Add(c31);
            table17.AddCell(p31);
            Chunk c32 = new Chunk(person.city, FontFactory.GetFont("Stika Small"));

            c32.Font.Color = new BaseColor(2, 2, 2);
            c32.Font.SetStyle(1);
            c32.Font.Size = 14;
            Phrase p32 = new Phrase();

            p32.Add(c32);
            table18.AddCell(p32);

            Chunk c33 = new Chunk(col.startedFrom + " " + col.endedOn, FontFactory.GetFont("Stika Small"));

            c33.Font.Color = new BaseColor(2, 2, 2);
            c33.Font.SetStyle(0);
            c33.Font.Size = 14;
            Phrase p33 = new Phrase();

            p33.Add(c33);
            table19.AddCell(p33);
            Chunk c34 = new Chunk(person.city, FontFactory.GetFont("Stika Small"));

            c34.Font.Color = new BaseColor(2, 2, 2);
            c34.Font.SetStyle(1);
            c34.Font.Size = 14;
            Phrase p34 = new Phrase();

            p34.Add(c34);
            table20.AddCell(p34);
            Chunk c35 = new Chunk(sch.startedFrom + " " + sch.endedOn, FontFactory.GetFont("Stika Small"));

            c35.Font.Color = new BaseColor(2, 2, 2);
            c35.Font.SetStyle(0);
            c35.Font.Size = 14;
            Phrase p35 = new Phrase();

            p35.Add(c35);
            table21.AddCell(p35);

            iTextSharp.text.Image jpg = iTextSharp.text.Image.GetInstance(@"C:\Users\Hp-PC\Desktop\temp1.png");
            jpg.ScaleToFit(2000, 1200);
            jpg.SetAbsolutePosition(0, 0);
            jpg.Alignment = iTextSharp.text.Image.UNDERLYING;

            doc1.Add(jpg);

            doc1.Add(table1);
            doc1.Add(table2);
            doc1.Add(table3);
            doc1.Add(table4);
            doc1.Add(table5);
            doc1.Add(table6);
            doc1.Add(table7);
            doc1.Add(table8);
            doc1.Add(table9);
            doc1.Add(table10);
            doc1.Add(table11);
            doc1.Add(table12);
            doc1.Add(table13);

            doc1.Add(table18);
            doc1.Add(table19);
            doc1.Add(table20);
            doc1.Add(table21);

            if (person.isExperienced == true)
            {
                doc1.Add(table14);
                doc1.Add(table15);
            }
            if (person.hasSkill == true)
            {
                doc1.Add(table16);
                doc1.Add(table17);
            }

            doc1.Close();
            MessageBox.Show("Created");
        }