You can combine PageRangeFilter and PageAreaFilter in one set to limit a redaction to an area on a specific page (or slide). Assign the filters array to the Filters property of ReplacementOptions. The same approach applies to PDF and to other formats that support page filters.
The following example demonstrates how to apply redaction to the bottom half of the last page in a PDF document.
constredaction=require('@groupdocs/groupdocs.redaction');constjava=require('java');constDimension=java.import('java.awt.Dimension');constPoint=java.import('java.awt.Point');constredactor=newredaction.Redactor('Sample.pdf');try{// Get the actual size information for the last page:
constinfo=redactor.getDocumentInfo();constlastPage=info.getPages().get(info.getPageCount()-1);constoptions=newredaction.ReplacementOptions('[secret]');options.setFilters(newredaction.RedactionFilter[]{newredaction.PageRangeFilter(redaction.PageSeekOrigin.End,0,1),newredaction.PageAreaFilter(newPoint(0,lastPage.getHeight()/2),newDimension(lastPage.getWidth(),lastPage.getHeight()/2))});constresult=redactor.apply(newredaction.ExactPhraseRedaction('bibliography',false,options));if(result.getStatus()!==redaction.RedactionStatus.Failed){redactor.save();}}finally{redactor.close();}
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.