is there a way to remove some text from header and footer in PDF using iText 7 in c#?
I found this code snippet from iText site, but apparently a license is need:
public void manipulatePdf(String dest) throws IOException {
//Load the license file to use cleanup features
LicenseKey.loadLicenseFile(System.getenv("ITEXT7_LICENSEKEY") + "/itextkey-multiple-products.xml");
PdfDocument pdfDoc = new PdfDocument(new PdfReader(SRC), new PdfWriter(dest));
List cleanUpLocations = new ArrayList();
cleanUpLocations.add(new PdfCleanUpLocation(1, new Rectangle(97, 405, 383, 40), Color.GRAY));
PdfCleanUpTool cleaner = new PdfCleanUpTool(pdfDoc, cleanUpLocations);
cleaner.cleanUp();
pdfDoc.close();
}
Link: https://kb.itextpdf.com/home/it7kb/faq/how-to-remove-text-from-a-pdf
Anyone has some code sample on removing text from header and footer?
PS: if someone knows how to edit and save the same file using iText will be great help
EDIT 1 I am adding the text myself in the PDF. I use the example found here in this page: https://kb.itextpdf.com/home/it7kb/faq/how-to-add-text-as-a-header-or-footer.
The question now is, how to remove the text I entered in the pdf after it has been saved to the file? I want to open the pdf back again and remove that text.
Edit2:
This post does not answer my question. The code inside manipulatePdf
method is exactly as the one I have pasted above initially. Classes like PdfCleanUpTool
are not found in the community edition.