public PdfPCell V2TempMain(CVModel model, System.Drawing.Image image, BaseColor mainColor, Font titleFont, Font simpleFont, Font skillsFont) { //Main dalis PdfPTable mainTable = new PdfPTable(2); mainTable.SplitLate = false; float[] mainWidths = new float[] { 38f, 73f }; mainTable.SetWidths(mainWidths); PdfPCell[] mainCells = new PdfPCell[2]; mainCells[0] = V2TempGreyTable(model, image, mainColor, titleFont, simpleFont); mainCells[1] = V2TempCareerBlock(model, titleFont, simpleFont, skillsFont, mainColor); //Sudeda mainCellus į main lentelę for (int i = 0; i < mainCells.Length; i++) { mainTable.AddCell(mainCells[i]); } //Sudeda visą main, į vieną cellą PdfPCell main = new PdfPCell(mainTable); main.Border = Rectangle.NO_BORDER; return(main); }
public ActionResult Edit(CVModel model) { if (ModelState.IsValid) { if (model.Picture != null) { _service.Edit(Convert(model)); } else { CVDTO dto = _service.Get(model.ID); dto.Address = model.Address; dto.Education = model.Education; dto.Email = model.Email; dto.Experience = model.Experience; dto.Qualities = model.Qualities; _service.Edit(dto); } return(RedirectToAction("List")); } else { return(View(model)); } }
public ActionResult EditCV(CVModel cv) { var account = Session["Account"] as LoginModel; user.chinhsua(account.Username, cv.FullName, cv.Email, cv.Age, cv.NumberPhone, cv.Address, cv.Goal); return(Redirect("/Candidate/Index")); }
public ActionResult Create() { ViewBag.Recaptcha = ReCaptcha.GetHtml(ConfigurationManager.AppSettings["ReCaptcha:SiteKey"]); ViewBag.publicKey = ConfigurationManager.AppSettings["ReCaptcha:SiteKey"]; CVModel model = (CVModel)TempData["CVModel"] ?? new CVModel(); return(View(model)); }
private byte[] V2Template(CVModel cvModel, System.Drawing.Image image) { using (MemoryStream ms = new MemoryStream()) { #region Grafika //Custom spalvos BaseColor headerColor = new BaseColor(70, 130, 180); BaseColor mainColor = new BaseColor(220, 220, 220); //Fontai string encoding = BaseFont.CP1257; bool embedded = BaseFont.EMBEDDED; Font nameFont = FontFactory.GetFont(BaseFont.TIMES_BOLD, encoding, embedded, 26, 0, BaseColor.BLUE); Font profFont = FontFactory.GetFont(BaseFont.TIMES_ROMAN, encoding, embedded, 16, 0, BaseColor.BLACK); Font simpleFont = FontFactory.GetFont(BaseFont.TIMES_ROMAN, encoding, embedded, 11, 0, BaseColor.BLACK); Font titleFont = FontFactory.GetFont(BaseFont.TIMES_BOLD, encoding, embedded, 12, 0, BaseColor.BLUE); Font skillsFont = FontFactory.GetFont(BaseFont.TIMES_BOLD, encoding, embedded, 9, 0, BaseColor.BLACK); //Tuscias langelis PdfPCell empty = new PdfPCell(new Phrase(" ")); empty.Border = Rectangle.NO_BORDER; #endregion //Sukuriamas dokumentas Document doc = new Document(PageSize.A4, 0, 0, 10, 10); PdfWriter.GetInstance(doc, ms); doc.Open(); //Pagrindinė lentelė PdfPTable table = new PdfPTable(1); table.TotalWidth = 595f; table.LockedWidth = true; //Header PdfPCell header = V2TempHeader(headerColor); //Title, asmeninės informacijos blokas PdfPCell title = V2TempPersonalInfo(cvModel, nameFont, profFont, simpleFont); //Main dalis, nautrauka, skilai, karjera PdfPCell main = V2TempMain(cvModel, image, mainColor, titleFont, simpleFont, skillsFont); //Sudeda viską į pagrindinę lentelę table.AddCell(header); table.AddCell(empty); table.AddCell(title); table.AddCell(empty); table.AddCell(main); table.SplitLate = false; //Sudeda turinį į dokumentą doc.Add(table); doc.Close(); return(ms.GetBuffer()); } }
private CVDTO Convert(CVModel model) => new CVDTO { Address = model.Address, Education = model.Education, ID = model.ID, Email = model.Email, Experience = model.Experience, FirstName = model.FirstName, LastName = model.LastName, Qualities = model.Qualities, PictureBytes = model.PictureBytes, PictureName = model.Picture.FileName };
public ActionResult SaveForm(CVModel model) { using (ApplicationDbContext context = new ApplicationDbContext()) { var userId = User.Identity.GetUserId(); var user = context.Users.Find(userId); var serializer = new JavaScriptSerializer(); var formData = serializer.Serialize(model); user.CVFormJson = formData; context.SaveChanges(); } return(Json(new { })); }
public ActionResult CVModel() { CVModel cvModel = new CVModel(); cvModel.AllPersons = _personRepository.All; cvModel.ComputerSkills = _computerSkill.All; cvModel.Educations = _educationRepository.All; cvModel.Expectations = _expectationRepository.All; cvModel.Jobs = _jobRepository.All; cvModel.Languages = _languageRepository.All; cvModel.PersonAttributes = _personAttributeRepository.All; return(View(cvModel)); }
public ActionResult GenerateDocument(HttpPostedFileBase file, string model, TemplateTypes template = 0) { Image sourceImage = null; if (file != null && file.ContentLength > 0) { sourceImage = Image.FromStream(file.InputStream); } CVModel cvModel = JsonConvert.DeserializeObject <CVModel>(model); byte[] documentData = builderService.GenerateDocumentBytes(cvModel, template, sourceImage); Field firstName = cvModel.ContactInfo.Items.FirstOrDefault()[ContactInfoItem.FirstName]; Field lastName = cvModel.ContactInfo.Items.FirstOrDefault()[ContactInfoItem.LastName]; return(File(documentData, "application/download", builderService.GetFileName(firstName, lastName, ".pdf"))); }
public ActionResult CheckModel(CVModel model) { model.PictureBytes = new byte[model.Picture.ContentLength]; model.Picture.InputStream.Read(model.PictureBytes, 0, model.Picture.ContentLength); if (ModelState.IsValid) { _service.Insert(Convert(model)); return(View(model)); } else { TempData["CVModel"] = model; return(RedirectToAction("Create")); } }
public ActionResult View(int id) { CVModel model = Convert(_service.Get(id)); Image img; using (MemoryStream stream = new MemoryStream(model.PictureBytes)) { img = new Bitmap(stream); } Image pic = Resize(img, 400, 400); using (MemoryStream ms = new MemoryStream()) { pic.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); model.PictureBytes = ms.GetBuffer(); } return(View(model)); }
public ActionResult Index(string Username) { /*if (Username == null) * Username = "******";*/ DataTable dt = user.getCV(Username); var model = new CVModel(); model.FullName = dt.Rows[0]["Fullname"].ToString(); model.Age = Convert.ToInt32(dt.Rows[0]["Age"].ToString()); model.NumberPhone = dt.Rows[0]["Numberphone"].ToString(); model.Address = dt.Rows[0]["Address"].ToString(); model.ID_Skills = Convert.ToInt32(dt.Rows[0]["ID_Skills"].ToString()); model.Goal = dt.Rows[0]["Goal"].ToString(); model.Email = dt.Rows[0]["Email"].ToString(); model.Image = dt.Rows[0]["Image"].ToString(); model.ID_Jobs = Convert.ToInt32(dt.Rows[0]["ID_Jobs"].ToString()); model.ID_Education = Convert.ToInt32(dt.Rows[0]["ID_Education"].ToString()); model.ID_Activities = Convert.ToInt32(dt.Rows[0]["ID_Activities"].ToString()); return(View(model)); }
public byte[] GenerateDocumentBytes(CVModel cvModel, TemplateTypes type, System.Drawing.Image image) { //Kolkas hardcodinta //turetu but viena funkcija, kuri duoda byte[] pagal sablono parametrus byte[] data = new byte[1]; switch (type) { case TemplateTypes.Valdemaro: data = VTemplate(cvModel, image); break; case TemplateTypes.Valdemaro2: data = V2Template(cvModel, image); break; default: break; } return(data); }
public PdfPCell V2TempCareerBlock(CVModel model, Font titleFont, Font simpleFont, Font skillsFont, BaseColor lineColor) { //Tuscias langelis PdfPCell empty = new PdfPCell(new Phrase(" ")); empty.Border = Rectangle.NO_BORDER; //Linija Paragraph pa = new Paragraph(new Chunk(new iTextSharp.text.pdf.draw.LineSeparator(0.0F, 100.0F, lineColor, Element.ALIGN_LEFT, 1))); PdfPTable career = new PdfPTable(2); career.SplitLate = false; float[] careerWidths = { 1f, 3f }; career.SetWidths(careerWidths); //Pakeisti, kai eis normaliai suvesti darbus PdfPCell careerTitle = new PdfPCell(new Phrase(model.CareerInfo.Name, titleFont)); careerTitle.Border = Rectangle.NO_BORDER; careerTitle.HorizontalAlignment = 0; PdfPCell line = new PdfPCell(pa); line.Border = Rectangle.NO_BORDER; line.HorizontalAlignment = 1; //centrinis lygiavimas career.AddCell(careerTitle); career.AddCell(line); renderV2TemplateCareer(model.CareerInfo, career, simpleFont); renderV2Skills(model.SkillsInfo, titleFont, skillsFont, career, line, simpleFont); renderV2Education(model.EducationInfo, titleFont, simpleFont, career, line); //Maincell priskiria visą carrer PdfPCell toReturn = new PdfPCell(); toReturn.AddElement(career); toReturn.Border = Rectangle.NO_BORDER; return(toReturn); }
public ActionResult CVEkle(HttpPostedFileBase file) { var user = userManager.Users.Single(i => i.UserName == HttpContext.User.Identity.Name); if (file != null && file.ContentLength > 0) { var extension = Path.GetExtension(file.FileName); if (extension == ".pdf" || extension == ".docx" || extension == ".doc") { var folder = Server.MapPath("~/uploads/UploadCV"); var randomfilename = Path.GetFileNameWithoutExtension(file.FileName) + "_" + Path.GetRandomFileName(); var filename = Path.ChangeExtension(randomfilename, extension); var path = Path.Combine(folder, filename); CVModel yeni = new CVModel(); yeni.FileName = filename; yeni.FilePath = path; yeni.PortalUserId = user.Id; db.CVler.Add(yeni); db.SaveChanges(); file.SaveAs(path); TempData["Success"] = "CV kaydedildi"; } else { TempData["message"] = "Gönderdiğiniz dosyanın uzantısı .pdf,.docx veya .doc olmalıdır"; } } else { TempData["message"] = "Bir dosya seçiniz"; } return(RedirectToAction("CVEkle")); }
// GET: Candidate public ActionResult Index() { var account = Session["Account"] as LoginModel; DataTable dt = user.getCV(account.Username); var model = new CVModel(); if (dt.Rows.Count == 0) { model.FullName = "0"; model.Age = 19; model.NumberPhone = "0"; model.Address = "0"; model.ID_Skills = 1; model.Goal = "0"; model.Email = "0"; model.Image = "0"; model.ID_Jobs = 1; model.ID_Education = 1; model.ID_Activities = 1; } else { model.FullName = dt.Rows[0]["Fullname"].ToString(); model.Age = Convert.ToInt32(dt.Rows[0]["Age"].ToString()); model.NumberPhone = dt.Rows[0]["Numberphone"].ToString(); model.Address = dt.Rows[0]["Address"].ToString(); model.ID_Skills = Convert.ToInt32(dt.Rows[0]["ID_Skills"].ToString()); model.Goal = dt.Rows[0]["Goal"].ToString(); model.Email = dt.Rows[0]["Email"].ToString(); model.Image = dt.Rows[0]["Image"].ToString(); model.ID_Jobs = Convert.ToInt32(dt.Rows[0]["ID_Jobs"].ToString()); model.ID_Education = Convert.ToInt32(dt.Rows[0]["ID_Education"].ToString()); model.ID_Activities = Convert.ToInt32(dt.Rows[0]["ID_Activities"].ToString()); } return(View(model)); }
public PdfPCell V2TempPersonalInfo(CVModel model, Font nameFont, Font profFont, Font simpleFont) { //Title, kur yra vardas ir kontaktinė info PdfPTable titleTable = new PdfPTable(2); titleTable.SplitLate = false; float[] titleWidths = new float[] { 3f, 2f }; titleTable.SetWidths(titleWidths); PdfPCell[] titleCells = new PdfPCell[2]; for (int i = 0; i < titleCells.Length; i++) { titleCells[i] = new PdfPCell(); } //Title langeliai realizuojami kaip naujos lentelės, tai garantuoja gerą lygiavimą PdfPTable nameTable = new PdfPTable(1); nameTable.SplitLate = false; Field firstName = model.ContactInfo.Items.FirstOrDefault()[ContactInfoItem.FirstName]; Field lastName = model.ContactInfo.Items.FirstOrDefault()[ContactInfoItem.LastName]; Field dateodBirth = model.PersonalInfo.Items.FirstOrDefault()[PersonalInfoItem.DateOfBirth]; string fullName = ""; if (!string.IsNullOrEmpty(firstName.Value)) { fullName = firstName.Value + " "; } if (!string.IsNullOrEmpty(lastName.Value)) { fullName = fullName + lastName.Value; } PdfPCell name = TextOnly(fullName, nameFont); name.Border = Rectangle.NO_BORDER; PdfPCell birth = TextOnly(dateodBirth.Value, profFont); birth.Border = Rectangle.NO_BORDER; //Elementai sudedami į nauja lentelę, o lentelę į titleCellą nameTable.AddCell(name); nameTable.AddCell(birth); titleCells[0].AddElement(nameTable); //Kontaktinės info lentelė PdfPTable personalTable = new PdfPTable(2); personalTable.SplitLate = false; float[] personalWidths = new float[] { 1f, 8f }; personalTable.SetWidths(personalWidths); //Emailas Field email = model.ContactInfo.Items.FirstOrDefault()[ContactInfoItem.Email]; if (!string.IsNullOrEmpty(email.Value)) { string emaillogo = "Images\\email.jpg"; PdfPCell emailIma = V2TempImage(emaillogo); PdfPCell emailVal = TextOnly(email.Value, simpleFont); personalTable.AddCell(emailIma); personalTable.AddCell(emailVal); } //Adresas Field address = model.ContactInfo.Items.FirstOrDefault()[ContactInfoItem.Address]; if (!string.IsNullOrEmpty(address.Value)) { string addresslogo = "Images\\address.jpg"; PdfPCell addressIma = V2TempImage(addresslogo); PdfPCell addressVal = TextOnly(address.Value, simpleFont); personalTable.AddCell(addressIma); personalTable.AddCell(addressVal); } //Telefonas Field phone = model.ContactInfo.Items.FirstOrDefault()[ContactInfoItem.Phone]; if (!string.IsNullOrEmpty(phone.Value)) { string phonelogo = "Images\\phone.jpg"; PdfPCell phoneIma = V2TempImage(phonelogo); PdfPCell phoneVal = TextOnly(phone.Value, simpleFont); personalTable.AddCell(phoneIma); personalTable.AddCell(phoneVal); } //Facebook Field facebook = model.ContactInfo.Items.FirstOrDefault()[ContactInfoItem.Facebook]; if (!string.IsNullOrEmpty(facebook.Value)) { string fblogo = "Images\\facebook.jpg"; PdfPCell fbIma = V2TempImage(fblogo); PdfPCell fbVal = TextOnly(facebook.Value, simpleFont); personalTable.AddCell(fbIma); personalTable.AddCell(fbVal); } //Į kitą titleTable cellą įdedami personalTable titleCells[1].AddElement(personalTable); //Nuimami borderiai titleCells[0].Border = Rectangle.NO_BORDER; titleCells[1].Border = Rectangle.NO_BORDER; //Celai sudedami į lentelę for (int i = 0; i < titleCells.Length; i++) { titleTable.AddCell(titleCells[i]); } //Lentelė paveršiama cell, dėl paprastumo PdfPCell title = new PdfPCell(titleTable); title.Border = Rectangle.NO_BORDER; return(title); }
public CVModel GenerateTestData() { ContactInfo contactInfo = new ContactInfo() { Items = new List <ContactInfoItem>() { new ContactInfoItem() { { ContactInfoItem.FirstName, new Field() { Id = 1, Label = "First name", Type = FieldTypes.SingleLiner, Mandatory = true } }, { ContactInfoItem.LastName, new Field() { Id = 2, Label = "Last name", Type = FieldTypes.SingleLiner, Mandatory = true } }, { ContactInfoItem.Email, new Field() { Id = 4, Label = "Email", Type = FieldTypes.SingleLiner, Mandatory = true } }, { ContactInfoItem.Address, new Field() { Id = 5, Label = "Address", Type = FieldTypes.SingleLiner, Mandatory = false } }, { ContactInfoItem.Phone, new Field() { Id = 6, Label = "Phone", Type = FieldTypes.Tel, Mandatory = true } }, { ContactInfoItem.Facebook, new Field() { Id = 7, Label = "Facebook", Type = FieldTypes.SingleLiner, Mandatory = false } } } } }; PersonalInfo personalInfo = new PersonalInfo() { Items = new List <PersonalInfoItem>() { new PersonalInfoItem() { { PersonalInfoItem.Photo, new Field() { Id = 1, Label = "Nuotrauka", //Reik image, bet dar neveikia Type = FieldTypes.File, Mandatory = false } }, { PersonalInfoItem.Summary, new Field() { Id = 2, Label = "Summary", //Reik multilane, bet dar neveikia Type = FieldTypes.MultiLiner, Mandatory = false } }, { PersonalInfoItem.Interest, new Field() { Id = 3, Label = "Personal internals", //Reik multilane, bet dar neveikia Type = FieldTypes.MultiLiner, Mandatory = false } }, { PersonalInfoItem.DateOfBirth, new Field() { Id = 4, Label = "Date of birth", Type = FieldTypes.Date, Mandatory = true } } } } }; CareerInfo careerInfo = new CareerInfo() { Items = new List <CareerInfoItem>() { new CareerInfoItem() { //Reikia suglaovti, kaip teisingai lesiti ivesti pvz 3 darbovietes { CareerInfoItem.Start, new Field() { Id = 1, //Jauciu, kaip Text paliksim, tik gal pasiūlysim pavyzdį duomenų įvedimo xxxx-xxxx Label = "Year interval begining", Type = FieldTypes.Date, Mandatory = false } }, { CareerInfoItem.End, new Field() { Id = 1, //Jauciu, kaip Text paliksim, tik gal pasiūlysim pavyzdį duomenų įvedimo xxxx-xxxx Label = "Year interval ending", Type = FieldTypes.Date, Mandatory = false } }, { CareerInfoItem.CompanyName, new Field() { Id = 2, Label = "Company name", Type = FieldTypes.SingleLiner, Mandatory = false } }, { CareerInfoItem.JobTitle, new Field() { Id = 3, Label = "Job title", Type = FieldTypes.SingleLiner, Mandatory = false } }, { CareerInfoItem.Description, new Field() { Id = 4, //Reik multilane, bet dar neveikia Label = "Description", Type = FieldTypes.MultiLiner, Mandatory = false } } } } }; EducationInfo educationInfo = new EducationInfo() { Items = new List <EducationInfoItem>() { new EducationInfoItem() { //Reikia vesti skaicius nuo 0 iki 100 { EducationInfoItem.Duration, new Field() { Id = 1, Label = "Duration", //Jauciu, kaip Text paliksim, tik gal pasiūlysim pavyzdį duomenų įvedimo xxxx-xxxx Type = FieldTypes.SingleLiner, Mandatory = false } }, { EducationInfoItem.End, new Field() { Id = 1, Label = "Year interval ending", //Jauciu, kaip Text paliksim, tik gal pasiūlysim pavyzdį duomenų įvedimo xxxx-xxxx Type = FieldTypes.Date, Mandatory = false } }, { EducationInfoItem.Course, new Field() { Id = 2, Label = "Course", Type = FieldTypes.SingleLiner, Mandatory = false } }, { EducationInfoItem.Institution, new Field() { Id = 3, Label = "Name of institution", Type = FieldTypes.SingleLiner, Mandatory = false } } } } }; SkillsInfo skillsInfo = new SkillsInfo() { Items = new List <SkillsInfoItem>() { new SkillsInfoItem() { { SkillsInfoItem.Skill, new Field() { Id = 1, Label = "Enter your skill", //Reik apibrezt,kad nuo 0 iki 100 Type = FieldTypes.SingleLiner, Mandatory = false } } } } }; CVModel CV = new CVModel(); CV.ContactInfo = contactInfo; CV.CareerInfo = careerInfo; CV.EducationInfo = educationInfo; CV.PersonalInfo = personalInfo; CV.SkillsInfo = skillsInfo; CV.FormTarget = "/Builder/GenerateDocument"; return(CV); }
public PdfPCell V2TempGreyTable(CVModel model, System.Drawing.Image image, BaseColor mainColor, Font titleFont, Font simpleFont) { //Tuscias langelis main dalies PdfPCell emptyMain = new PdfPCell(new Phrase(" ")); emptyMain.Border = Rectangle.NO_BORDER; emptyMain.BackgroundColor = mainColor; PdfPTable personalInfo = new PdfPTable(1); personalInfo.SplitLate = false; //Paveikslelis kolkas is serverio Image jpg = getPhoto(image); if (jpg != null) { jpg.ScaleToFit(120f, 100f); jpg.Alignment = Element.ALIGN_CENTER; PdfPCell photo = new PdfPCell(jpg); photo.PaddingTop = 15f; photo.PaddingBottom = 15f; photo.HorizontalAlignment = 1; photo.BackgroundColor = mainColor; photo.Border = Rectangle.NO_BORDER; //Pridedama nuotrauka personalInfo.AddCell(photo); } //Summary PdfPCell summary = new PdfPCell(); summary.BackgroundColor = mainColor; summary.Border = Rectangle.NO_BORDER; Field summ = model.PersonalInfo.Items.FirstOrDefault()[PersonalInfoItem.Summary]; if (!string.IsNullOrEmpty(summ.Value)) { PdfPTable summaryTable = new PdfPTable(1); PdfPCell summTitle = TextOnly(summ.Label, titleFont); summTitle.Border = Rectangle.NO_BORDER; summTitle.BackgroundColor = mainColor; PdfPCell summVal = TextOnly(summ.Value, simpleFont); summVal.Border = Rectangle.NO_BORDER; summVal.BackgroundColor = mainColor; summaryTable.AddCell(summTitle); summaryTable.AddCell(summVal); summary.AddElement(summaryTable); } //Pridedamas summary personalInfo.AddCell(emptyMain); personalInfo.AddCell(summary); personalInfo.AddCell(emptyMain); //Asmeninės savybės PdfPCell personalInternals = new PdfPCell(); personalInternals.BackgroundColor = mainColor; personalInternals.Border = Rectangle.NO_BORDER; Field internals = model.PersonalInfo.Items.FirstOrDefault()[PersonalInfoItem.Interest]; if (!string.IsNullOrEmpty(internals.Value)) { //Splitinamos, vėliau reiks multilane tai keisis String[] values = internals.Value.Split(','); PdfPTable internalsTable = new PdfPTable(1); PdfPCell internalsTitle = TextOnly(internals.Label, titleFont); internalsTitle.Border = Rectangle.NO_BORDER; internalsTitle.BackgroundColor = mainColor; internalsTable.AddCell(internalsTitle); foreach (string value in values) { //Istrina perteklinius tarpus string remaked = value.Trim(); PdfPCell persInte = TextOnly(remaked, simpleFont); persInte.Border = Rectangle.NO_BORDER; persInte.BackgroundColor = mainColor; //Sudedam į lentelę internalsTable.AddCell(persInte); } //Sudedam į 1 cellą personalInternals.AddElement(internalsTable); } //Pridedam į main lentelę personalInfo.AddCell(personalInternals); //Priskiriam vienam cellui PdfPCell toReturn = new PdfPCell(); toReturn.AddElement(personalInfo); //Atitraukiam nuo krašto toReturn.PaddingLeft = 25f; toReturn.Border = Rectangle.NO_BORDER; return(toReturn); }
private byte[] VTemplate(CVModel model, System.Drawing.Image image) { using (MemoryStream ms = new MemoryStream()) { #region Grafika //Linija BaseColor lineColor = new BaseColor(208, 208, 80); Paragraph pa = new Paragraph(new Chunk(new iTextSharp.text.pdf.draw.LineSeparator(0.0F, 100.0F, lineColor, Element.ALIGN_LEFT, 1))); pa.SpacingBefore = 0f; pa.SpacingAfter = 10f; //Spalvos var titleColor = new BaseColor(10, 10, 170); //Fontai string encoding = BaseFont.CP1257; bool embedded = BaseFont.EMBEDDED; Font nameFont = FontFactory.GetFont(BaseFont.TIMES_ROMAN, encoding, embedded, 18, 0, BaseColor.BLACK); Font additionFont = FontFactory.GetFont(BaseFont.TIMES_ITALIC, encoding, embedded, 8, 0, titleColor); Font paragraphFont = FontFactory.GetFont(BaseFont.TIMES_BOLDITALIC, encoding, embedded, 12, 0, BaseColor.BLUE); Font infoFont = FontFactory.GetFont(BaseFont.TIMES_ROMAN, encoding, embedded, 12, 0, BaseColor.BLACK); #endregion Document doc = new Document(PageSize.A4); PdfWriter.GetInstance(doc, ms); doc.Open(); //Paveikslėlis Image jpg = getPhoto(image); if (jpg != null) { jpg.ScaleToFit(120f, 100f); jpg.Alignment = Element.ALIGN_LEFT; jpg.SetAbsolutePosition(455f, 725f); } //title lentelė PdfPTable title2 = new PdfPTable(1); title2.HorizontalAlignment = 0; title2.SpacingAfter = 0f; title2.SpacingBefore = 0f; Field firstName = model.ContactInfo.Items.FirstOrDefault()[ContactInfoItem.FirstName]; Field lastName = model.ContactInfo.Items.FirstOrDefault()[ContactInfoItem.LastName]; string title = ""; if (!string.IsNullOrEmpty(firstName?.Value)) { title = firstName.Value + " "; } if (!string.IsNullOrEmpty(lastName?.Value)) { title = title + lastName.Value; } PdfPCell a = TextOnly(title + "\n", nameFont); a.BorderColor = BaseColor.WHITE; Chunk d = new Chunk("Curriculum vitae", additionFont); d.SetBackground(BaseColor.LIGHT_GRAY); PdfPCell b = new PdfPCell(new Phrase(d)); PdfPCell c = TextOnly(" "); b.BorderColor = BaseColor.WHITE; c.BorderColor = BaseColor.WHITE; title2.AddCell(a); title2.AddCell(b); title2.AddCell(c); title2.AddCell(c); doc.Add(title2); if (jpg != null) { doc.Add(jpg); } model.PersonalInfo.Items.FirstOrDefault()[PersonalInfoItem.Photo].Value = null; RenderSection(model.ContactInfo, paragraphFont, infoFont, pa, doc); RenderSection(model.PersonalInfo, paragraphFont, infoFont, pa, doc); RenderSection(model.EducationInfo, paragraphFont, infoFont, pa, doc); RenderSection(model.CareerInfo, paragraphFont, infoFont, pa, doc); RenderSection(model.SkillsInfo, paragraphFont, infoFont, pa, doc); doc.Close(); return(ms.GetBuffer()); } }