OpenPDF
OpenPDF copied to clipboard
showText isn't creating new lines if string is bigger than pdf width
Describe the bug showText isn't creating new lines if string is bigger than pdf width
To Reproduce Code to reproduce the issue
String s1 = "OpenPDF is open source software with a LGPL and MPL license. It is a fork of iText version 4, more specifically iText svn tag 4.2.0, which was hosted publicly on sourceforge with LGPL and MPL license headers in the source code, and LGPL and MPL license documents in the svn repository. Beginning with version 5.0 of iText, the developers have moved to the AGPL to improve their ability to sell commercial licenses.";
contentByte.setFontAndSize(BaseFont.createFont(fontFileName, BaseFont.IDENTITY_H, false), fontSize);
contentByte.beginText();
contentByte.beginMarkedContentSequence(new PdfStructureElement(element2, PdfName.P));
contentByte.setTextMatrix(document.leftMargin(), 600);
contentByte.showText(s1);
contentByte.endMarkedContentSequence();
contentByte.endText();
Expected behavior I expect string to move to next line if page-end is hit.
Screenshots
System (please complete the following information):
- OS: Windows
- Used Font:
Additional context Add any other context about the problem here.
This holds true, even if I use an LayoutProcessor
supported font.
Hello @TarunNanduri , our group are interested in this issue, and we will try to fix it. ---- SE_SUSTech, group: Lanrand
Great, Looking forward!
Dont't use the low-level API directly. See e.g. https://github.com/LibrePDF/OpenPDF/wiki/Paragraphs