Enter the code snippet as shown below:
var workStream = new MemoryStream(); var doc = new Document(PageSize.LETTER, 10, 10, 42, 35); PdfWriter.GetInstance(doc, workStream).CloseStream = false; doc.Open(); var builder = new StringBuilder(); builder.Append("MY LONG HTML TEXT"); var parsedHtmlElements = HTMLWorker.ParseToList(new StringReader(builder.ToString()), null); foreach (var htmlElement in parsedHtmlElements) doc.Add(htmlElement); doc.Close(); byte[] byteInfo = workStream.ToArray(); workStream.Write(byteInfo, 0, byteInfo.Length); workStream.Position = 0; return new FileStreamResult(workStream, "application/pdf")
And there is one problem - how to make this pdf sound? Is there any method or something that quickly does this?
source share