Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 13, 2012 12:56 AM by graciax8
Member
5 Points
22 Posts
Dec 10, 2012 06:58 AM|LINK
I am using iTextSharp to generate pdf.
My code is,
public FileStreamResult Export(int ID) { MemoryStream stream = new MemoryStream(); Document pdf = new Document(); PdfWriter writer = PdfWriter.GetInstance(pdf, stream); pdf.Open(); //code for table PdfPTable table = new PdfPTable(3); PdfPCell cell = new PdfPCell(new Phrase("Header spanning 3 columns")); cell.Colspan = 3; cell.HorizontalAlignment = 1; table.SpacingBefore = 100; //not working table.SpacingAfter = 10; //not working table.AddCell(cell); table.AddCell("Col 1 Row 1"); table.AddCell("Col 2 Row 1"); table.AddCell("Col 3 Row 1"); table.AddCell("Col 1 Row 2"); table.AddCell("Col 2 Row 2"); table.AddCell("Col 3 Row 2"); pdf.Add(table); pdf.Close(); //code to download Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename="+_child[0].Child_Name+".pdf"); Response.Buffer = true; Response.Clear(); Response.OutputStream.Write(stream.GetBuffer(), 0, stream.GetBuffer().Length); Response.OutputStream.Flush(); Response.End(); return new FileStreamResult(Response.OutputStream, "application/pdf"); }
The table appears in top of the page. but i want to move table down.How can i do?
Please Help,
Thanks.
Participant
751 Points
210 Posts
Dec 13, 2012 12:56 AM|LINK
See this link.
http://www.codeproject.com/Questions/351802/Its-possible-put-a-table-in-absolute-position-with
kishore.efer...
Member
5 Points
22 Posts
Move table down : itextsharp
Dec 10, 2012 06:58 AM|LINK
I am using iTextSharp to generate pdf.
My code is,
public FileStreamResult Export(int ID) { MemoryStream stream = new MemoryStream(); Document pdf = new Document(); PdfWriter writer = PdfWriter.GetInstance(pdf, stream); pdf.Open(); //code for table PdfPTable table = new PdfPTable(3); PdfPCell cell = new PdfPCell(new Phrase("Header spanning 3 columns")); cell.Colspan = 3; cell.HorizontalAlignment = 1; table.SpacingBefore = 100; //not working table.SpacingAfter = 10; //not working table.AddCell(cell); table.AddCell("Col 1 Row 1"); table.AddCell("Col 2 Row 1"); table.AddCell("Col 3 Row 1"); table.AddCell("Col 1 Row 2"); table.AddCell("Col 2 Row 2"); table.AddCell("Col 3 Row 2"); pdf.Add(table); pdf.Close(); //code to download Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename="+_child[0].Child_Name+".pdf"); Response.Buffer = true; Response.Clear(); Response.OutputStream.Write(stream.GetBuffer(), 0, stream.GetBuffer().Length); Response.OutputStream.Flush(); Response.End(); return new FileStreamResult(Response.OutputStream, "application/pdf"); }The table appears in top of the page. but i want to move table down.How can i do?
Please Help,
Thanks.
graciax8
Participant
751 Points
210 Posts
Re: Move table down : itextsharp
Dec 13, 2012 12:56 AM|LINK
See this link.
http://www.codeproject.com/Questions/351802/Its-possible-put-a-table-in-absolute-position-with
mycodepad.blogspot.com || TUMBLR