tzxylao / onegeno-itext-pdf Goto Github PK
View Code? Open in Web Editor NEWitext7 编写一个复杂PDF,大家可以拿来参考itext7的使用
itext7 编写一个复杂PDF,大家可以拿来参考itext7的使用
我需要判断上方的内容,如果没有超过一页,那么就要计算补全多少个换行符,才能使右下角的内容在页面最底部显示
搜索了很多计算内容渲染高度的方法,但是计算出来与实际不符
就算铺满整页,高度还是返回795.084,但我的页面是A4高度842-20(上下边距)-1(边框宽度)=821
private static float getCellHeight(Document doc, Cell cell) {
Table table = new Table(4);
table.addCell(cell);
IRenderer tableRenderer = table.createRendererSubTree().setParent(doc.getRenderer());
LayoutResult tableLayoutResult = tableRenderer.layout(new LayoutContext(
new LayoutArea(1, new Rectangle(0, 0,
PageSize.A4.getWidth(),
1e4f
))));
log.info("cell height {}", tableLayoutResult.getOccupiedArea().getBBox().getHeight());
return tableLayoutResult.getOccupiedArea().getBBox().getHeight();
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.