在 iText 7 中添加灰线 b/w 段落
Adding gray line b/w paragraph in iText 7
我不确定如何在 Itext 7 中添加图像 b/w 段落中的灰线。
我应该使用非常小的宽度和整个页面长度的矩形吗?
Rectangle rect= new Rectangle(1, 400);
如何使整页长度与硬编码相同?
您可以使用以下代码:
Document document = new Document(pdfDocument);
document.add(new Paragraph("Hello"));
document.add(new Div().setHeight(5).setBackgroundColor(ColorConstants.LIGHT_GRAY));
document.add(new Paragraph("World"));
document.close();
要达到图片显示的效果:
我不确定如何在 Itext 7 中添加图像 b/w 段落中的灰线。
我应该使用非常小的宽度和整个页面长度的矩形吗?
Rectangle rect= new Rectangle(1, 400);
如何使整页长度与硬编码相同?
您可以使用以下代码:
Document document = new Document(pdfDocument);
document.add(new Paragraph("Hello"));
document.add(new Div().setHeight(5).setBackgroundColor(ColorConstants.LIGHT_GRAY));
document.add(new Paragraph("World"));
document.close();
要达到图片显示的效果: