fix on pdf export: trim empty spaces
This commit is contained in:
parent
9e5029e1ab
commit
c53e086518
|
@ -2,6 +2,7 @@ package org.opencdmp.filetransformer.docx.service.wordfiletransformer.word;
|
||||||
|
|
||||||
import org.apache.poi.xwpf.usermodel.*;
|
import org.apache.poi.xwpf.usermodel.*;
|
||||||
import org.apache.xmlbeans.XmlCursor;
|
import org.apache.xmlbeans.XmlCursor;
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
import org.jsoup.nodes.Document;
|
import org.jsoup.nodes.Document;
|
||||||
import org.jsoup.nodes.Node;
|
import org.jsoup.nodes.Node;
|
||||||
import org.jsoup.nodes.TextNode;
|
import org.jsoup.nodes.TextNode;
|
||||||
|
@ -61,6 +62,10 @@ public class HtmlToWorldBuilder implements NodeVisitor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void head(Node node, int i) {
|
public void head(Node node, int i) {
|
||||||
|
|
||||||
|
String htmlToPlainText = Jsoup.parse(node.outerHtml()).text();
|
||||||
|
if (htmlToPlainText.trim().isEmpty()) return;
|
||||||
|
|
||||||
String name = node.nodeName();
|
String name = node.nodeName();
|
||||||
if (name.equals("#text")) {
|
if (name.equals("#text")) {
|
||||||
String text = ((TextNode)node).text();
|
String text = ((TextNode)node).text();
|
||||||
|
|
Loading…
Reference in New Issue