有如下代码:
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")
还有问题 - 我想在我的 pdf 中加入一些波兰语字母(如“ą”、“ę” 等)怎么做?