OpenPDF icon indicating copy to clipboard operation
OpenPDF copied to clipboard

[bug] ERROR: Infinite table loop

Open lpf4254302 opened this issue 9 months ago • 2 comments

Describe the bug

there is a text "ERROR: Infinite table loop" in the last page of the pdf file, when a long text in the Cell and the Cell is higher than the Height

To Reproduce

float[] widths = {100F}; PdfPTable table = new PdfPTable(1); table.setHorizontalAlignment(Element.ALIGN_LEFT); table.setTotalWidth(widths); table.setWidths(widths); table.setLockedWidth(true); PdfPCell cell; Font font = FontFactory.getFont("/Users/wensibudong/IdeaProjects/testcompare/src/main/resources/font/simsun.ttc,0", BaseFont.IDENTITY_H, true); cell = new PdfPCell(); cell.setFixedHeight(rotate.getHeight() - 20 + 1); cell.setPaddingTop(0); cell.setPaddingBottom(0); cell.setPaddingLeft(0); cell.setPaddingRight(0); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_TOP); Paragraph phrase = new Paragraph(); phrase.setLeading(Float.NaN); phrase.setFont(font); String a = "13、世事早已擦肩而过,我们又何必反复追忆,反复提起。是时候和昨天告别了,忘记一切,也原谅一切。是真的忘记13、世事早已擦肩而过,我们又何必反复追忆,反复提起。是时候和昨天告别了,忘记一切,也原谅一切。是真的忘记13、世事早已擦肩而过,我们又何必反复追忆,反复提起。是时候和昨天告别了,忘记一切,也原谅一切。是真的忘记13、世事早已擦肩而过,我们又何必反复追忆,反复提起。是时候和昨天告别了,忘记一切,也原谅一切。是真的忘记13、世事早已擦肩而过,我们又何必反复追忆,反复提起。是时候和昨天告别了,忘记一切,也原谅一切。是真的忘记13、世事早已擦肩而过,我们又何必反复追忆,反复提起。是时候和昨天告别了,忘记一切,也原谅一切。是真的忘记13、世事早已擦肩而过,我们又何必反复追忆,反复提起。是时候和昨天告别了,忘记一切,也原谅一切。是真的忘记13、世事早已擦肩而过,我们又何必反复追忆,反复提起。是时候和昨天告别了,忘记一切,也原谅一切。是真的忘记13、世事早已擦肩而过,我们又何必反复追忆,反复提起。是时候和昨天告别了,忘记一切,也原谅一切。是真的忘记13、世事早已擦肩而过,我们又何必反复追忆,反复提起。是时候和昨天告别了,忘记一切,也原谅一切。是真的忘记13、世事早已擦肩而过,我们又何必反复追忆,反复提起。是时候和昨天告别了,忘记一切,也原谅一切。是真的忘记13、世事早已擦肩而过,我们又何必反复追忆,反复提起。是时候和昨天告别了,忘记一切,也原谅一切。是真的忘记13、世事早已擦肩而过,我们又何必反复追忆,反复提起。是时候和昨天告别了,忘记一切,也原谅一切。是真的忘记13、世事早已擦肩而过,我们又何必反复追忆,反复提起。是时候和昨天告别了,忘记一切,也原谅一切。是真的忘记13、世事早已擦肩而过,我们又何必反复追忆,反复提起。是时候和昨天告别了,忘记一切,也原谅一切。是真的忘记13、世事早已擦肩而过,我们又何必反复追忆,反复提起。是时候和昨天告别了,忘记一切,也原谅一切。是真的忘记13、世事早已擦肩而过,我们又何必反复追忆,反复提起。是时候和昨天告别了,忘记一切,也原谅一切。是真的忘记13、世事早已擦肩而过,我们又何必反复追忆,反复提起。是时候和昨天告别了,忘记一切,也原谅一切。是真的忘记13、世事早已擦肩而过,我们又何必反复追忆,反复提起。是时候和昨天告别了,忘记一切,也原谅一切。是真的忘记"; phrase.add(a); cell.getColumn().setLeading(0F, 1.2F); cell.getColumn().addText(phrase); table.addCell(cell);

Expected behavior

I know that,if the fixHeight > pageSize,it will happened,this error tips will make me confused

Screenshots

System

(please complete the following information)

  • OS:
  • Used font:simsun
  • OpenPDF version:1.3.34

Your real name

Pengfei Liu

Additional context

lpf4254302 avatar May 13 '24 07:05 lpf4254302

See: https://github.com/LibrePDF/OpenPDF/blob/master/openpdf/src/main/java/com/lowagie/text/pdf/PdfDocument.java#L2617

andreasrosdal avatar May 13 '24 07:05 andreasrosdal

Seems related to #514 , but there it uses Table, not PdfPTable

asturio avatar May 21 '24 11:05 asturio