![](/img/trans.png)
[英]error CS0246: The type or namespace name 'IWebHostEnvironment' could not be found (are you missing a using directive or an assembly reference?)
[英]Error 14 The type or namespace name 'Document' could not be found (are you missing a using directive or an assembly reference?)
Document document = new Document();
MemoryStream stream = new MemoryStream();
try
{
PdfWriter pdfWriter = PdfWriter.GetInstance(document, stream);
pdfWriter.CloseStream = false;
document.Open();
document.Add(new Paragraph("Hello World"));
}
catch (DocumentException de)
{
Console.Error.WriteLine(de.Message);
}
catch (IOException ioe)
{
Console.Error.WriteLine(ioe.Message);
}
document.Close();
stream.Flush(); //Always catches me out
stream.Position = 0; //Not sure if this is required
return File(stream, "application/pdf");
我對pdf writer和Paragraph有同樣的錯誤
我遇到了同樣的問題然后我找到了答案
首先要確保將iTextSharp.dll添加到引用和
然后在主要表格的開頭。 加上這個
using iTextSharp.text;
using iTextSharp.text.pdf;
iTextSharp.text負責文檔對象
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.