PdfCleanUpProcessor
我想通过使用以下代码来提供 PDF 编辑功能:
Rectangle redactionRectangle = new Rectangle(74, 503, 385, 761);
PdfReader pdfReader = new PdfReader(sourcePath);
PdfStamper pdfStamper = new PdfStamper(pdfReader,
new FileStream(destinationPath, FileMode.Create));
List<PdfCleanUpLocation> cleanUpLocations = new List<PdfCleanUpLocation>
{
new PdfCleanUpLocation(1, redactionRectangle, BaseColor.WHITE)
};
PdfCleanUpProcessor cleaner = new PdfCleanUpProcessor(cleanUpLocations, pdfStamper);
cleaner.CleanUp();
pdfStamper.Close();
这适用于没有图像的 PDF,但带有图像的 PDF 会导致异常。
不支持颜色深度 1。
你调用的对象是空的。