I use iTextSharp to create PDF files for an ASP.NET application, it seems that working in PDF format works fine, although I find iTextSharp a bit unintuitive to use, but that's a different story.
I put the data in a table inside my PDF file, now I want to place the HTML content in a table cell and support its formatting / styling. I saw many examples demonstrating how to parse HTML to PDF using iTextSharp and support formatting, but the examples all spit out the content directly into the document object , for example. doc.addElement () I tried to adapt the code to align the parsed HTML content into a table cell, for example. instead...
objects = HTMLWorker.ParseToList(new StringReader(htmlString), styles);
for (int k = 0; k < objects.Count; ++k)
{
document.Add((IElement) objects[k]);
}
I use...
Cell cell = new Cell();
objects = HTMLWorker.ParseToList(new StringReader(htmlString), styles);
for (int k = 0; k < objects.Count; ++k)
{
cell.Add((IElement) objects[k]);
}
table.AddCell(cell);
document.Add(table);
, , , . - .
http://blog.rubypdf.com/2007/10/10/using-htmlworker-to-parse-html-snippets-and-convert-to-pdf/
. CSS, <h1> , <h1> ..