phax / ph-pdf-layout

Java library for creating fluid page layouts with Apache PDFBox. Supporting multi-page tables, different page layouts etc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cut Text like "overflow:hidden" in css

terrason opened this issue · comments

Hello,
I need my table cell hide overflow text, like set "overflow:hidden" style in css
Is there any way to do this?

I am now figuring the max words in a cell by:

        // my cell's width is WidthSpec.perc(30)
        double area=0.3*pages.getAvailableWidth() * this.tableCellHeight-(2*Constants.POINTS_PER_MM*Constants.POINTS_PER_MM);
        double areaPerFont=(fontSize + LINE_SPACING*Constants.POINTS_PER_MM)*fontSize;
        this.tableCellWordsLimit=(int)(area / areaPerFont);

Unfortunately this is not work, the result tableCellWordsLimit is higher than seen.

Try setting a "maxWidth" and/or "maxHeight" of an object to reproduce this effect. I try to create an example snippet

Try setting a "maxWidth" and/or "maxHeight" of an object to reproduce this effect. I try to create an example snippet

Thank you for repling. setMaxHeight on Table cell seams not working
image

Yeah - its overflow:visible

I found a way to do this and added it into the latest 7.3.1-SNAPSHOT version. The class AbstractPLBox received a method setClipContent (boolean) which you can use to clip content to the display area. This therefore works for PLBox and PLTableCell. See the example code I created that outputs this PDF:
issue34.pdf

If that suits your needs, I will build a release.

Yes, this suits my job. Wonderful

Part of the 7.3.1 release