Crear PDF a partir de HTML Con ItextSharp – Convert HTML to PDF (with ItextSharp)

Autor: Matías Creimerman

2013-04-15

"Crear PDF a partir de HTML Con ItextSharp – Convert HTML to PDF (with ItextSharp)"

public void HTMLToPDF(string html, string fullDestinyFilePath)
{
StringWriter sw = new StringWriter();
sw.WriteLine(html);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document();
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, new FileStream(fullDestinyFilePath, FileMode.Create));
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
}

This content is property of Matias Creimerman.
Any misuse of this material will be punishable.
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.