我要求做以下项目,
我必须尝试下面的代码,
public static void main(String[] args) throws IOException, DocumentException
{
File file = new File(DEST); file.getParentFile().mkdirs();
new BrefingPackageHighlight_Main2().manipulatePdf(SRC, DEST);
}
public void manipulatePdf(String src, String dest) throws IOException, DocumentException
{
PdfReader reader = new PdfReader(src);
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest)); PdfContentByte canvas = stamper.getOverContent(2); canvas.saveState(); canvas.setColorFill(BaseColor.YELLOW);
canvas.rectangle(200, 786, 5, 5);
canvas.fill();
canvas.restoreState();
stamper.close();
reader.close();
}
上面的代码只突出显示第二页的顶部。请提供示例以搜索一个特定关键字并单独突出显示。