pdf 文本和图片解析iText |
您所在的位置:网站首页 › 怎样删除pdf文档中的文字和图片不留痕迹 › pdf 文本和图片解析iText |
itext pdf写入可见附件
libinqqq: 真没看懂 pdf 文本和图片解析iTextW3C_Newbie: 请问能获取页码吗 itext在pdf中画虚线暮霭晨辰: nice,学习了 itext在pdf中画虚线melongblood: 网上有个简单的方法,甚至不需要计算单元格的边界之类的。而且可以兼容cell.setBackgroundColor。[code=java] public class CustomCellSlant implements PdfPCellEvent { public void cellLayout(PdfPCell cell, Rectangle position, PdfContentByte[] canvases) { PdfContentByte cb = canvases[PdfPTable.LINECANVAS]; cb.saveState(); cb.setLineWidth(0.5f); cb.setLineDash(new float[] {5.0f, 0.0f}, 0); cb.moveTo(position.getLeft(), position.getTop()); cb.lineTo(position.getRight(), position.getBottom()); cb.stroke(); cb.restoreState(); } } // document.open(); CustomCellSlant slant = new CustomCellSlant(); cell = new PdfPCell(new Phrase("test")); cell.disableBorderSide(2); cell.setBackgroundColor(new BaseColor(204, 204, 204)); cell.setCellEvent(slant); table.addCell(cell); [/code] itext在pdf中画虚线melongblood: 已经解决了,表格中不设置背景色,而是用canvas.setRGBColorFill(red, green, blue);,就可以跟画的线不冲突了。 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |