生成的pdf文件中的文本换行问题 [英] Text wrapping issue in generated pdf file

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

问题描述

我遇到了以pdf格式包装文本的问题。对于像xls,rtf和pptx这样的所有格式,报告工作正常,但是在pdf中,一些文本被包装,即文本的一些字母,尤其是最后几个字母在下一行中打印。我已经尝试了该文本属性中的几乎所有选项。我可以减少效果的唯一方法是将pdf字体名称更改为这些文本的罗马时间。但是,即使这在某些情况下也不起作用。

I have an issue related to wrapping of text in pdf format. For all the formats like xls,rtf, and pptx the report works fine,however in pdf some text gets wrapped i.e. some letters of the text especially the last few letters gets printed in the next line. I have tried almost all the options in the properties for that text. The only way I could reduce the effect was by changing the pdf font name to times roman for those text. However even this does not work in some case.

该片段包含问题 TextField

<textField  isBlankWhenNull="true">
    <reportElement positionType="Float" x="560" y="0" width="60" height="20"/>
    <box leftPadding="2">
        <pen lineWidth="0.5"/>
        <topPen lineWidth="0.5"/>
        <leftPen lineWidth="0.5"/>
        <bottomPen lineWidth="0.5"/>
        <rightPen lineWidth="0.5"/>
    </box>
    <textElement>
        <font fontName="Arial Unicode MS"  isPdfEmbedded="false"/>
    </textElement>
    <textFieldExpression class="java.lang.String"><![CDATA[$F{CustState}]]>
    </textFieldExpression>
</textField>

如果您为此分享一些解决方案,我将非常感激。
谢谢......

I would be very grateful if you share some solution for this. Thanks...

当我从Ireport 4.0.2生成报告时,我遇到此问题

P.s I get this issue when i generate the report from Ireport 4.0.2

推荐答案

首先,使用字体扩展。您的问题很可能是因为JasperReports(iText)在生成PDF时没有使用您希望它使用的字体。字体扩展解决了这个问题。

First, use Font Extensions. Your issue is very likely because JasperReports (iText) isn't using the font that you want it to be using when generating the PDF. Font Extensions solve this.

其次,您可能遇到了一个已修复的问题。 JasperReports 4.1.1更改日志包括:

Second, it's possible that you're encountering an issue that got fixed. The JasperReports 4.1.1 Change Log includes this:

net.sf.jasperreports.export.pdf.force。 linebreak.policy 配置属性现已弃用,因为PDF文本呈现代码已重构,因此文本的呈现方式与AWT完全相同

这篇关于生成的pdf文件中的文本换行问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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