109,345
社区成员




VS2022 导入了itext7
测试 HelloWorld 失败……
实际文件夹里是创建了pdf文件,但是内容是空的。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using iText;
using System.Windows.Forms;
using iText.Kernel.Geom;
using iText.Kernel.Pdf.Canvas;
using iText.Kernel.Pdf.Xobject;
using iText.Kernel.Pdf;
using System.Security.Cryptography;
using Rectangle = iText.Kernel.Geom.Rectangle;
using iText.Layout.Element;
using iText.Layout.Properties;
using iText.Layout;
//点击按钮创建PDF
private void button3_Click(object sender, EventArgs e)
{
PdfWriter writer = new PdfWriter("D:/hellowprld.pdf");
PdfDocument pdf = new PdfDocument(writer);
Document document = new Document(pdf);
document.Add(new Paragraph("Hello World!"));
document.Close();
}