我正在经历here所示的iText7快速入门示例。在“发布数据库”部分中。我创建了一个基本的.Net Console应用程序以及复制粘贴的代码。我在行process(table, line, bold, true);
和process(table, line, font, false);
上不断收到“名称空间'进程'在当前上下文中不存在”错误
我在参考PDFsharp here时遇到了类似的问题,它说要使用System.Diagnostics.Process.Start
,但这似乎并不能解决我的问题。
var writer = new PdfWriter(dest);
var pdf = new PdfDocument(writer);
var document = new Document(pdf, PageSize.A4.Rotate());
document.SetMargins(20, 20, 20, 20);
var font = PdfFontFactory.CreateFont(FontConstants.HELVETICA);
var bold = PdfFontFactory.CreateFont(FontConstants.HELVETICA_BOLD);
var table = new Table(new float[] { 4, 1, 3, 4, 3, 3, 3, 3, 1 });
table.SetWidth(UnitValue.CreatePercentValue(100));
StreamReader sr = File.OpenText(DATA);
var line = sr.ReadLine();
process(table, line, bold, true);
while ((line = sr.ReadLine()) != null)
{
process(table, line, font, false);
}
sr.Close();
document.Add(table);
document.Close();
删除“当前上下文中不存在名称空间'进程'”错误的正确方法是什么?