我想通过删除矩形区域内的内容来提供PDF编辑功能。我使用此处的代码:iTextSharp - Crop PDF File (C#)
static void textsharpie()
{
string file = "C:\\testpdf.pdf";
string oldchar = "testpdf.pdf";
string repChar = "test.pdf";
PdfReader reader = new PdfReader(file);
PdfStamper stamper = new PdfStamper(reader, new FileStream(file.Replace(oldchar, repChar), FileMode.Create, FileAccess.Write));
List<PdfCleanUpLocation> cleanUpLocations = new List<PdfCleanUpLocation>();
cleanUpLocations.Add(new PdfCleanUpLocation(1, new iTextSharp.text.Rectangle(0f, 0f, 600f, 115f), iTextSharp.text.BaseColor.WHITE));
PdfCleanUpProcessor cleaner = new PdfCleanUpProcessor(cleanUpLocations, stamper);
cleaner.CleanUp();
stamper.Close();
reader.Close();
}
在某些PDF文档中,通过更改某些修剪文本行的坐标(参见附图)
,这种方法无法正常工作还有其他人遇到过这个问题吗?