Last post May 23, 2012 06:01 AM by FightAsABull
May 21, 2012 04:11 PM|jeffcarter|LINK
I am creating a PDF based on a html template like this that has a table:
string contents = File.ReadAllText(Server.MapPath("~/PDFs/templatehtml.htm"));
contents = contents.Replace("[Label1]", Label1.Text);
var parsedHtmlElements = HTMLWorker.ParseToList(new StringReader(contents), null);
foreach (var htmlElement in parsedHtmlElements)
document.Add(htmlElement as IElement);
The problem: The width of all the table cell is same, but I want to change width of each column differently, like i want width of last columkn to be 236px, fist column 40px etc..
I have tried changing that in html template but it doesn't reflect in the PDF.
any solution ?
May 21, 2012 04:22 PM|MahadTECH|LINK
Figured it out. Apparently table.Width is a percent and not the width in pixels. So using:
table.Width = 100;
Worked like a charm.
May 21, 2012 04:30 PM|jeffcarter|LINK
Like I mentioned above, i do not have table defined in my code, I am using html table as a template and the table lies in the html page not .cs.
May 23, 2012 06:01 AM|FightAsABull|LINK
Hi, please create a table: