pdfbox换行文字 [英] pdfbox wrap text

查看:517
本文介绍了pdfbox换行文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PDFBox以下代码:

I am using PDFBox wit hthe following code:

doc = new PDDocument();
page = new PDPage();

doc.addPage(page);
PDFont font = PDType1Font.COURIER;

pdftitle = new PDPageContentStream(doc, page);
pdftitle.beginText();
pdftitle.setFont( font, 12 );
pdftitle.moveTextPositionByAmount( 40, 740 );
pdftitle.drawString("Here I insert a lot of text");
pdftitle.endText();
pdftitle.close();

有谁知道如何包装文本以便它自动转到另一行?非常感谢!

Does anyone know how I can wrap the text so that it automatically goes to another line? Thanks a lot!

推荐答案

我认为不可能自动包装文本。但你可以自己包装你的文字。请参阅如何使用PDFBox drawString插入换行符如何使用PDFbox 创建修订宽度段落

I don´t think it is possible to wrap text automatically. But you can wrap your text yourself. See How to Insert a Linefeed with PDFBox drawString and How can I create fix-width paragraph with PDFbox

这篇关于pdfbox换行文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆