admin管理员组

文章数量:1648973

在实际开发中,发现在table中显示中文,渲染出来的pdf,中文内容不自动换行。经过搜索发现了一种解决方案,如下:

重写Breaker,修改right计算方式

/*

* Breaker.java

* Copyright (c) 2004, 2005 Torbj�rn Gannholm,

* Copyright (c) 2005 Wisconsin Court System

*

* This program is free software; you can redistribute it and/or

* modify it under the terms of the GNU Lesser General Public License

* as published by the Free Software Foundation; either version 2.1

* of the License, or (at your option) any later version.

*

* This program is distributed in the hope that it will be useful,

* but WITHOUT ANY WARRANTY; without even the implied warranty of

* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

* GNU Lesser General Public License for more details.

*

* You should have received a copy of the GNU Lesser General Public License

* along with this program; if not, write to the Free Software

* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*

*/

package org.xhtmlrenderer.layout;

import org.xhtmlrenderer.css.constants.IdentValue;

import org.xhtmlrenderer.css.style.CalculatedStyle;

import org.xhtmlrenderer.render.FSFont;

/**

* A utility class that scans the text of a single inline box, looking for the

* next break point.

* @author Torbj&#x

本文标签: 中文换行JavaPDFxhtmlrenderer