I want to move the paragraphn to the left side.
Also resizze the Font size in list item
table = new PdfPTable(2); table.TotalWidth = 500f; table.LockedWidth = true; phrase = new Phrase(); phrase.Add(new Chunk("Work Experience:"+"\n\n", FontFactory.GetFont("Arial", 10, Font.BOLD))); phrase.Add(new Chunk( txtDesc.Text.ToString() +"\n\n", FontFactory.GetFont("Arial", 8, Font.NORMAL))); phrase.Add(new Chunk(txtComname.Text + "\n\n", FontFactory.GetFont("Arial", 5, Font.NORMAL))); iTextSharp.text.ListItem li = new iTextSharp.text.ListItem(); List list = new List(List.UNORDERED,10f); list.SetListSymbol("\u2022"); string s=FontFactory.GetFont("Arial",8,Font.NORMAL).ToString(); list.Add(txttask1.Text); list.Add(txttask2.Text); list.Add(txttask3.Text); Paragraph p = new Paragraph(); p.Add(list); cell.AddElement(p); table.AddCell(PhraseCell(phrase, PdfPCell.ALIGN_LEFT)); table.AddCell(cell);
{ Document ds = new Document(PageSize.A4,100f,2f, 20f, 10f); System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(); PdfWriter writer = PdfWriter.GetInstance(ds, memoryStream); Phrase phrase = null; PdfPCell cell = null; PdfPTable table = null; if (fuImg.HasFile) { fuImg.SaveAs(Server.MapPath("Images//" + fuImg.FileName)); } ds.Open(); table = new PdfPTable(2); table.HorizontalAlignment = 0; table.SetWidths(new float[] { 0.30f, 0.80f }); table.TotalWidth = 500f; table.LockedWidth = true; table.SpacingBefore = 20f; cell = image("~/Images/" + fuImg.FileName + "", 35f, PdfPCell.LEFT_BORDER); table.AddCell(cell); phrase = new Phrase(); phrase.Add(new Chunk("\n"+txtName.Text.ToString(),FontFactory.GetFont("Arial",19, Font.BOLD,BaseColor.GREEN))); phrase.Add(new Chunk("\n"+ txtDesc.Text.ToString() +"\n\n", FontFactory.GetFont("Arial", 9, Font.NORMAL))); phrase.Add(new Chunk(txtObj.Text.ToString(),FontFactory.GetFont("Arial",8,Font.ITALIC))); cell = PhraseCell(phrase, PdfPCell.ALIGN_LEFT); cell.VerticalAlignment = PdfPCell.ALIGN_LEFT; //cell.PaddingBottom = 10f; table.AddCell(cell); ds.Add(table); table = new PdfPTable(8); table.SetWidths(new float[] { 3f, 13f,3f,17f, 3f,15f, 4f,20f }); table.TotalWidth = 500f; table.LockedWidth = true; table.SpacingBefore = 20f; table.HorizontalAlignment = Element.ALIGN_LEFT; phrase = new Phrase(); iTextSharp.text.Image pic = iTextSharp.text.Image.GetInstance(Server.MapPath("~/Images/call2.jpg")); pic.ScaleAbsolute(8f,8f); cell.AddElement(new Chunk(pic, 3f,8f)); table.AddCell(cell); table.AddCell(PhraseCell(new Phrase(txtPhnum.Text + "", FontFactory.GetFont("Arial", 9, Font.BOLD)), PdfPCell.ALIGN_LEFT)); PdfPCell cell1 = new PdfPCell(); iTextSharp.text.Image Mail = iTextSharp.text.Image.GetInstance(Server.MapPath("~/Images/Mail.png")); Mail.ScaleAbsolute(9f, 9f); cell1.AddElement(new Chunk(Mail, 3f, 9f)); cell1.BorderWidthTop = 0; cell1.BorderWidthRight = 0; cell1.BorderWidthLeft = 0; cell1.BorderWidthBottom = 0; table.AddCell(cell1); table.AddCell(PhraseCell(new Phrase( txtMid.Text + "", FontFactory.GetFont("Arial", 9, Font.BOLD)), PdfPCell.ALIGN_LEFT)); PdfPCell cell2 = new PdfPCell(); iTextSharp.text.Image Skpe = iTextSharp.text.Image.GetInstance(Server.MapPath("~/Images/Skype.png")); Skpe.ScaleAbsolute(12f, 12f); cell2.AddElement(new Chunk(Skpe, 3f, 9f)); cell2.BorderWidthTop = 0; cell2.BorderWidthRight = 0; cell2.BorderWidthLeft = 0; cell2.BorderWidthBottom = 0; table.AddCell(cell2); table.AddCell(PhraseCell(new Phrase( txtSkyid.Text + "", FontFactory.GetFont("Arial", 9, Font.BOLD)), PdfPCell.ALIGN_LEFT)); PdfPCell cell3 = new PdfPCell(); iTextSharp.text.Image City = iTextSharp.text.Image.GetInstance(Server.MapPath("~/Images/City.png")); Skpe.ScaleAbsolute(8f, 8f); cell3.AddElement(new Chunk(City, 3f, 9f)); cell3.BorderWidthTop = 0; cell3.BorderWidthRight = 0; cell3.BorderWidthLeft = 0; cell3.BorderWidthBottom = 0; table.AddCell(cell3); table.AddCell(PhraseCell(new Phrase(txtCity.Text + "", FontFactory.GetFont("Arial", 9, Font.BOLD)), PdfPCell.ALIGN_LEFT)); table.AddCell(PhraseCell(phrase, PdfPCell.ALIGN_LEFT)); cell = PhraseCell(new Phrase(), PdfPCell.ALIGN_LEFT); cell.PaddingBottom = 30f; table.AddCell(cell); ds.Add(table); table = new PdfPTable(2); table.HorizontalAlignment = 0; // table.SetWidths(new float[] {10f,2f}); table.TotalWidth = 500f; table.LockedWidth = true; phrase = new Phrase(); phrase.Add(new Chunk("Work Experience:"+"\n\n", FontFactory.GetFont("Arial", 10, Font.BOLD))); phrase.Add(new Chunk( txtDesc.Text.ToString() +"\n\n", FontFactory.GetFont("Arial", 8, Font.NORMAL))); phrase.Add(new Chunk(txtComname.Text + "\n\n\n", FontFactory.GetFont("Arial", 5, Font.NORMAL))); iTextSharp.text.ListItem li = new iTextSharp.text.ListItem(); List list = new List(List.UNORDERED); list.SetListSymbol("\u2022"); list.Add(txttask1.Text); list.Add(txttask2.Text); list.Add(txttask3.Text); Paragraph p = new Paragraph(); p.Add(list); cell.AddElement(p); p.Alignment = Element.ALIGN_CENTER; p.IndentationLeft = 20; p.IndentationRight = 20; table.AddCell(PhraseCell(phrase, PdfPCell.ALIGN_LEFT)); table.AddCell(cell); phrase = new Phrase(); phrase.Add(new Chunk("Work Experience:" + "\n\n", FontFactory.GetFont("Arial", 10, Font.BOLD))); table.AddCell(PhraseCell(phrase, PdfPCell.ALIGN_LEFT)); /// table.AddCell(cell); // cell = PhraseCell(phrase, PdfPCell.ALIGN_LEFT); ds.Add(table); ds.Close(); byte[] bytes = memoryStream.ToArray(); memoryStream.Close(); Response.Clear(); Response.ContentType = "application/pdf"; Response.AddHeader("Content-Disposition", "attachment; filename=Employee.pdf"); Response.ContentType = "application/pdf"; Response.Buffer = true; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.BinaryWrite(bytes); Response.End(); Response.Close(); }
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.