![]() Int spaceIndex = text.indexOf(' ', lastSpace + 1) Įn las soluciones anteriores por String textNL = "I am trying to create a PDF file with a lot of text contents in the document. String text = "I am trying to create a PDF file with a lot of text contents in the document. PDRectangle mediabox = page.findMediaBox() įloat width = mediabox.getWidth() - 2*margin įloat startX = mediabox.getLowerLeftX() + margin įloat startY = mediabox.getUpperRightY() - margin PDPageContentStream contentStream = new PDPageContentStream(doc, page) Juntando todo se obtiene algo como esto (con pequeñas diferencias dependiendo de la versión de PDFBox): PDFBox 1.8.x PDDocument doc = null ![]() ![]() Puedes usar el método PDFont getStringWidth para eso. Añadiendo a la respuesta de Mark es posible que desee saber dónde dividir su cadena larga.
0 Comments
Leave a Reply. |